-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.htaccess
172 lines (133 loc) · 4.87 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# ------------------------------------------------------------------------------
# | UTF-8 encoding |
# ------------------------------------------------------------------------------
<IfModule mod_mime.c>
AddCharset utf-8 .atom .scss .css .js .json .jsonld .rss .vtt .webapp .html .xml .txt
</IfModule>
# ------------------------------------------------------------------------------
# | Additionnal charset/types/etc. |
# ------------------------------------------------------------------------------
<IfModule mod_mime.c>
# Audio
AddType audio/mp4 m4a f4a f4b
AddType audio/mpeg mp3
AddType audio/ogg oga ogg opus
AddType audio/wav wav
AddType audio/webm webma
# Data interchange
AddType application/json json map
AddType application/ld+json jsonld
# JavaScript
# Normalize to standard type.
# http://tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript js
# Video
AddType video/mp4 f4v f4p m4v mp4
AddType video/ogg ogv
AddType video/webm webm
AddType video/x-flv flv
# Web fonts
AddType application/font-woff woff
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttc ttf
AddType application/x-font-woff woff
AddType application/font-woff2 .woff2
AddType font/opentype otf
# Make SVGZ fonts work on the iPad.
# https://twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svgz
AddEncoding gzip svgz
# Other
AddType application/octet-stream safariextz
AddType application/x-chrome-extension crx
AddType application/x-opera-extension oex
AddType application/x-web-app-manifest+json webapp
AddType application/x-xpinstall xpi
AddType application/xml atom rdf rss xml
AddType image/webp webp
AddType image/x-icon cur
AddType image/x-icon .ico
AddType text/cache-manifest appcache manifest
AddType text/css .css
AddType image/svg+xml svg
AddType text/vtt vtt
AddType text/x-component htc
AddType text/x-vcard vcf
AddType application/vnd.openxmlformats .docx .pptx .xlsx .xltx . xltm .dotx .potx .ppsx
</IfModule>
# ------------------------------------------------------------------------------
# | Compression |
# ------------------------------------------------------------------------------
<IfModule mod_deflate.c>
AddOutputFilter INCLUDES;DEFLATE js
AddOutputFilter INCLUDES;DEFLATE css
AddOutputFilter INCLUDES;DEFLATE php
AddOutputFilter INCLUDES;DEFLATE html
AddOutputFilter INCLUDES;DEFLATE xml
AddOutputFilter INCLUDES;DEFLATE ico
# webfonts
AddOutputFilter INCLUDES;DEFLATE eot
AddOutputFilter INCLUDES;DEFLATE svg
AddOutputFilter INCLUDES;DEFLATE ttf
# others
AddOutputFilter INCLUDES;DEFLATE json
</IfModule>
# ------------------------------------------------------------------------------
# | Security |
# ------------------------------------------------------------------------------
# Stops a browser from trying to MIME-sniff
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
</IfModule>
# Avoid Clickjacking and enable XSS-protection for browsers
<IfModule mod_headers.c>
# security
Header set X-Frame-Options "DENY"
Header set X-XSS-Protection "1; mode=block"
</IfModule>
# ------------------------------------------------------------------------------
# | Cache + |
# ------------------------------------------------------------------------------
# CACHE + ETags
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf|ogv|mp3|mp4|webm|svg|ttf|woff|woff2|eot|js|css|pdf|txt)$">
<IfModule mod_headers.c>
Header unset Set-Cookie
Header set Cache-Control "max-age=21772800"
header set vary "Accept-Encoding"
header append vary "User-Agent"
header append Cache-Control "public"
header append Keep-Alive "timeout=5, max=100"
header append Connection "Keep-Alive"
FileETag None
</IfModule>
</FilesMatch>
# 10 minutes = HTML, XML (RSS), JSON
<FilesMatch "\.(html|htm|xml|json)$">
<IfModule mod_headers.c>
Header set Cache-Control "max-age=600"
header set vary "Accept-Encoding"
header append vary "User-Agent"
header append Cache-Control "private"
FileETag None
</IfModule>
</FilesMatch>
# DONT CACHE = NO CACHE FOR PHP
<FilesMatch "\.(pl|php|cgi|spl)$">
<IfModule mod_headers.c>
Header unset Cache-Control
Header unset Expires
Header unset Last-Modified
Header unset Pragma
#BrowserMatch "MSIE" force-no-vary
FileETag None
header set vary "Accept-Encoding"
header append vary "User-Agent"
header append Cache-Control "private"
#Header set X-UA-Compatible "IE=edge"
</IfModule>
</FilesMatch>
# ------------------------------------------------------------------------------
# | Custom error messages / pages |
# ------------------------------------------------------------------------------
# lost & found
ErrorDocument 404 /404.html