-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
72 lines (69 loc) · 3.49 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#rewrite rules for URLs and directory patterns
#https://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteEngine
#https://httpd.apache.org/docs/current/mod/core.html#options
#https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
#https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions
<IfModule mod_rewrite.c>
#Options +FollowSymLinks
#Options +SymLinksIfOwnerMatch
RewriteEngine On
#check for 200 header, legitimate url
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
#redirect from the `http://` to the `https://` version of the URL.
#https://wiki.apache.org/httpd/RewriteHTTPToHTTPS
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*)$ https://%{HTTP_HOST}/~jason/$1 [R=301,L]
#RewriteRule ^(/~jason|index\.html|about\.html|code\.html|talks\.html)$ https://%{HTTP_HOST}/~jason/$1 [R=301,L]
#RewriteRule ^(index\.html|about\.html|code\.html|contact\.html|search\.html|sitemap\.html|talks\.html)$ https://%{HTTP_HOST}/~jason/$1 [R=301,L]
#remove need to have .html extension in filename
#RewriteCond %{REQUEST_FILENAME}.html -f
#RewriteRule ^(.*)$ $1.html [L,QSA]
</IfModule>
#specify 'strict-transport-security' header to force HTTPS connections
#https://https.cio.gov/hsts/
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</IfModule>
#serve all resources labeled as `text/html` or `text/plain` with the media type `charset` parameter set to `utf-8`.
#https://httpd.apache.org/docs/current/mod/core.html#adddefaultcharset
AddDefaultCharset utf-8
#serve resources with the proper media types (f.k.a. MIME types).
#https://www.iana.org/assignments/media-types/media-types.xhtml
#serve the following file types with the media type `charset` parameter set to `utf-8`.
#https://httpd.apache.org/docs/current/mod/mod_mime.html#addcharset
<IfModule mod_mime.c>
DefaultLanguage en
AddLanguage en-US .html .css .js
AddCharset utf-8 .html .css .js .xml .json .rss .atom
AddType application/javascript js
AddType application/json json
AddType application/xml atom rdf rss xml
</IfModule>
# Compress all output labeled with one of the following media types.
# https://httpd.apache.org/docs/current/mod/mod_filter.html#addoutputfilterbytype
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/atom+xml" \
"application/javascript" \
"application/json" \
"application/ld+json" \
"application/manifest+json" \
"application/rdf+xml" \
"application/rss+xml" \
"application/schema+json" \
"application/vnd.geo+json" \
"application/x-javascript" \
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"image/svg+xml" \
"text/cache-manifest" \
"text/css" \
"text/html" \
"text/javascript" \
"text/plain" \
"text/vcard" \
"text/xml"
</IfModule>