-
Notifications
You must be signed in to change notification settings - Fork 6
/
.htaccess
122 lines (100 loc) · 3.86 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Restricted access to files
<FilesMatch "((\.(lock|cache|db))|installed.json|composer.json|package.json|bower.json|CHANGELOG.md|README.md|gulpfile.js|webpack.config.js|pagekit)$">
# Apache < 2.3
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
Satisfy All
</IfModule>
# Apache ≥ 2.3
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
</FilesMatch>
# Don't show directory listings
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# URL rewrites
<IfModule mod_rewrite.c>
RewriteEngine On
# Set base if your site is running in a VirtualDocumentRoot
# RewriteBase /
# Redirect requests to access the site with the 'www.' prefix
# RewriteCond %{HTTP_HOST} .
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect requests to access the site without the 'www.' prefix
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
# Redirect requests to access the site with HTTPS
# RewriteCond %{HTTPS} off
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
# Rewrite request to use the index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
<IfModule !mod_env.c>
<IfModule mod_headers.c>
RequestHeader set MOD_REWRITE "On"
</IfModule>
</IfModule>
</IfModule>
# Redirect admin URL, if rewrite is not enabled
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch (.*)(?<!index.php)\/admin$ $1/index.php/admin
</IfModule>
</IfModule>
# Media types
<IfModule mod_mime.c>
AddType image/svg+xml svg svgz
<IfModule mod_deflate.c>
AddEncoding gzip svgz
</IfModule>
</IfModule>
# Normalize javascript mime type
<IfModule mod_mime.c>
AddType application/javascript js
</IfModule>
# Compression
<IfModule mod_deflate.c>
# Force compression for mangled `Accept-Encoding` request headers
# https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/javascript" \
"application/json" \
"application/rss+xml" \
"image/bmp" \
"image/svg+xml" \
"image/x-icon" \
"text/css" \
"text/html" \
"text/plain"
</IfModule>
</IfModule>
# Expire headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 week"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/rss+xml "access plus 0 seconds"
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType text/plain "access plus 0 seconds"
# Use expires far in the future for css and javascript because Pagekit uses filenames to break the cache
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
# Avoid PHP 5.6 deprecated $HTTP_RAW_POST_DATA warnings
<IfModule mod_php5.c>
php_value always_populate_raw_post_data -1
</IfModule>