-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.htaccess
50 lines (39 loc) · 1.57 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
# Put filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml
# Drop some browsers which can create problem.
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
<filesMatch ".(ico|pdf|jpg|jpeg|png|svg|webp|gif|js|css)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
#Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \?\S+
RewriteRule ^/?$ %{QUERY_STRING}? [L]
# now convert all & to /
RewriteRule ^([^&]+)&(.*)$ $1/$2 [L]
# now convert all = to /
RewriteRule ^([^=]+)=([^=]+=.*)$ $1-$2 [L]
RewriteRule ^([^=]+)=([^=]+)$ $1-$2 [L,R=308]
# finally an internal rule to replace /n1/v1/n2/v2 to QUERY_STRING
RewriteRule "^([^/]+)-([^/]*)(?:/(.*))?$" $3?$1=$2 [L,QSA]
## Your existing stuff followed now
RewriteRule ^index\.php$ - [L,R=308]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]