forked from aarondunn/bugkick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
98 lines (81 loc) · 2.71 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
Options +FollowSymLinks
AddDefaultCharset UTF-8
RewriteEngine on
RewriteBase /
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
#################### speedup begin ####################
# add mime-type and encoding
AddType 'text/css; charset=utf-8' .css
AddType 'text/javascript; charset=utf-8' .js
AddType 'image/x-icon; charset=utf-8' .ico
AddType 'text/html; charset=utf-8' .html .shtml
AddType 'text/xml; charset=utf-8' .xml
AddType audio/mp4 .m4a
AddType audio/flac .flac
AddType audio/mpeg .mp3
AddType audio/ogg .ogg .oga
AddType audio/wav .wav
AddType video/ogg .ogm .ogv .ogg
AddType video/mp4 .mp4 .m4v .f4v
AddType video/webm .webm
AddType video/x-flv .flv
AddType application/pdf .pdf
AddType application/vnd.ms-fontobject .eot
AddType application/octet-stream .otf .ttf
AddType application/x-font-ttf .ttf
AddType application/x-woff .woff
# add file comporessing
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css text/json application/json
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component image/x-icon
# handle bandy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch Konqueror no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
<FilesMatch "\.(?!(mp3|ogg|avi|ttf|otf|eot|svg)$)">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
<IfModule mod_headers.c>
Header append Vary User-Agent
# add header gzip:
<IfModule mod_deflate.c>
<FilesMatch "\.gz$">
Header set Content-Encoding gzip
</FilesMatch>
</IfModule>
# allow file caching on client side
# NEVER CACHE
<FilesMatch "\.(html|htm|php|cgi|pl)$">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
</FilesMatch>
# 1 YEAR
<FilesMatch "\.(jpg|jpeg|png|gif|js|css|ico|swf|flv|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
Header set Last-Modified "Thu, 31 Dec 2000 23:59:59 GMT"
Header set Expires "Thu, 31 Dec 2037 23:59:59 GMT"
Header set Cache-Control "public, max-age=31536000"
Header set Accept-Ranges "bytes"
</FilesMatch>
# 3 HOUR
<FilesMatch "\.(txt|xml)$">
Header set Cache-Control "max-age=10800"
</FilesMatch>
</IfModule>
# add header Expires with one month term
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
# Expires off for HTML and PHP
<FilesMatch .*\.(shtml|html|phtml|php)$>
ExpiresActive Off
</FilesMatch>
</IfModule>
# ETag header (core feature)
FileETag MTime Size
#################### speedup end ####################