-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.htaccess
142 lines (115 loc) · 4.78 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
## Uncomment the following block to force SSL when accessing /admin
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{REQUEST_URI} /admin/
# RewriteCond %{SERVER_PORT} 80
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# </IfModule>
####### DO NOT EDIT BELOW THIS LINE ########
#MARK#######################################
######## KOKEN .htaccess rules ########
############################################
## Make sure settings.css.lens is rendered as CSS
AddType text/css .lens
## SVG MIME type as some servers don't have it
AddType image/svg+xml .svg
## UTF-8 encoding for everything
AddDefaultCharset utf-8
DirectoryIndex index.php index.html
## Enable gzip.
## Highly recommended as it will increase speed for
## both the console and your published site.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/json application/javascript application/x-javascript
</IfModule>
## END gzip
## Rewrite Rules (Pretty URLs)
## These rules remove index.php/ from your published site links
## and also speed up the serving of cached images.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Pass images requests back to PHP if they do not exist
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} /storage/cache/images(/(([0-9]{3}/[0-9]{3})|custom)/.*)$
RewriteRule . /i.php?path=%1 [L]
# Pass albums requests back to PHP if they do not exist
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} /storage/cache/albums(/([0-9]{3}/[0-9]{3})/.*)$
RewriteRule . a.php?path=%1 [L]
# Catch root requests (pjax)
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{QUERY_STRING} _pjax=
RewriteCond %{DOCUMENT_ROOT}/storage/cache/site/index/cache.phtml -f
RewriteRule .* /storage/cache/site/index/cache.phtml [L]
# Catch root requests
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{QUERY_STRING} !_pjax=
RewriteCond %{DOCUMENT_ROOT}/storage/cache/site/index/cache.html -f
RewriteRule .* /storage/cache/site/index/cache.html [L]
# Catch site requests (pjax)
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{QUERY_STRING} _pjax=
RewriteCond %{DOCUMENT_ROOT}/storage/cache/site%{REQUEST_URI}cache.phtml -f
RewriteRule . /storage/cache/site%{REQUEST_URI}cache.phtml [L]
# Catch site requests
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{QUERY_STRING} !_pjax=
RewriteCond %{HTTP_COOKIE} !share_to_tumblr=
RewriteCond %{DOCUMENT_ROOT}/storage/cache/site%{REQUEST_URI}cache.html -f
RewriteRule . /storage/cache/site%{REQUEST_URI}cache.html [L]
# CSS / RSS caching
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/storage/cache/site%{REQUEST_URI} -f
RewriteRule . /storage/cache/site%{REQUEST_URI} [L]
# Rewrite any old URLs that still use index.php?/this/that syntax
RewriteCond %{QUERY_STRING} ^/(.*)
RewriteRule ^index.php %1? [R,L]
# Rewrite any old URLs that still use index.php/this/that syntax
RewriteRule ^index.php/(.*)$ $1 [R,L]
# Catch root requests
RewriteRule ^(index.php)?$ /app/site/site.php?url=/ [L,QSA]
# Do not enable path rewriting for files that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !favicon.ico
# For requests that are not actual files
# rewrite to index.php?/PATH
RewriteRule ^(.*)$ /app/site/site.php?url=/$1 [L,QSA]
</IfModule>
## This ruleset ensures core Koken JS and CSS are cached
## for 1 year. These files are always timestamped in new releases,
## so it is safe to cache them for long periods of time.
<IfModule mod_expires.c>
ExpiresActive On
# Set default to 0 so .php/API requests are not cached
ExpiresDefault A0
# Do not cache MP4s, as Chrome and others tend to fail on first playback
<FilesMatch "\.mp4$">
<IfModule mod_headers.c>
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</IfModule>
</FilesMatch>
# Console javascript and CSS is timestamped and can be aggressively cached
<FilesMatch "console_.*\.(js|css)$">
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
</FilesMatch>
# Cached images are timestamped and can be aggressively cached
<FilesMatch "\.\d{9,10}\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>
## End Rewrite Rules
############################################
####### END KOKEN .htaccess rules ########
############################################