Skip to content
Newer
Older
100644 507 lines (366 sloc) 18 KB
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
1 # Apache configuration file
2 # httpd.apache.org/docs/2.2/mod/quickreference.html
0bb9495 @paulirish new .htaccess template with some common settings.. still need to be r…
paulirish authored
3
170b0da Add note and link regarding best practices for Apache config
Craig Barnes authored
4 # Note .htaccess files are an overhead, this logic should be in your Apache config if possible
5 # httpd.apache.org/docs/2.2/howto/htaccess.html
6
5a8f128 @paulirish apache tricks from perishablepress. also a no-www fix from jstnryan
paulirish authored
7 # Techniques in here adapted from all over, including:
8 # Kroc Camen: camendesign.com/.htaccess
9 # perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
10 # Sample .htaccess file of CMS MODx: modxcms.com
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
11
12
961ec54 @paulirish Moved all server configurations (except apache's .htaccess) over to a…
paulirish authored
13 ###
d8a3970 @mathiasbynens Check if mod_headers is available before matching webfont files. This…
mathiasbynens authored
14 ### If you run a webserver other than Apache, consider:
4a69c41 @necolas Update urls in .htaccess to reference the new repo and wiki locations
necolas authored
15 ### github.com/h5bp/server-configs
961ec54 @paulirish Moved all server configurations (except apache's .htaccess) over to a…
paulirish authored
16 ###
17
18
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
19
20 # ----------------------------------------------------------------------
21 # Better website experience for IE users
22 # ----------------------------------------------------------------------
23
fdd14c1 @paulirish chrome frame and IE=edge as a header
paulirish authored
24 # Force the latest IE version, in various cases when it may fall back to IE7 mode
25 # github.com/rails/rails/commit/123eb25#commitcomment-118920
68c75c0 @paulirish remove duplicate cache manifest expires rules
paulirish authored
26 # Use ChromeFrame if it's installed for a better experience for the poor IE folk
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
27
9f9d6ee @paulirish Header append Vary Accept-Encoding - thx aaron peters.
paulirish authored
28 <IfModule mod_headers.c>
d8a3970 @mathiasbynens Check if mod_headers is available before matching webfont files. This…
mathiasbynens authored
29 Header set X-UA-Compatible "IE=Edge,chrome=1"
30 # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
31 <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|xpi|safariextz|vcf)$" >
32 Header unset X-UA-Compatible
33 </FilesMatch>
cfbd24a @paulirish ifmodule headers for all those jerkfaces out there who dont have mod_…
paulirish authored
34 </IfModule>
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
35
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
36
37 # ----------------------------------------------------------------------
38 # Cross-domain AJAX requests
39 # ----------------------------------------------------------------------
40
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
41 # Serve cross-domain ajax requests, disabled.
6794dc3 @paulirish adding a bit mroe around the commented out CORS
paulirish authored
42 # enable-cors.org
b57c5c8 @paulirish minor. htaccess comment
paulirish authored
43 # code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
44
6794dc3 @paulirish adding a bit mroe around the commented out CORS
paulirish authored
45 # <IfModule mod_headers.c>
46 # Header set Access-Control-Allow-Origin "*"
47 # </IfModule>
0bb9495 @paulirish new .htaccess template with some common settings.. still need to be r…
paulirish authored
48
49
50
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
51 # ----------------------------------------------------------------------
52 # Webfont access
53 # ----------------------------------------------------------------------
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
54
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
55 # Allow access from all domains for webfonts.
56 # Alternatively you could only whitelist your
c72a81c @mathiasbynens Use example.com instead of domain.com, as per RFC 2606. Fixes #613.
mathiasbynens authored
57 # subdomains like "subdomain.example.com".
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
58
d8a3970 @mathiasbynens Check if mod_headers is available before matching webfont files. This…
mathiasbynens authored
59 <IfModule mod_headers.c>
60 <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
61 Header set Access-Control-Allow-Origin "*"
d8a3970 @mathiasbynens Check if mod_headers is available before matching webfont files. This…
mathiasbynens authored
62 </FilesMatch>
63 </IfModule>
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
64
65
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
66
67 # ----------------------------------------------------------------------
68 # Proper MIME type for all files
69 # ----------------------------------------------------------------------
70
b14b4a6 @paulirish Normalize javascript mimetype to application/javascript. Reduces cruf…
paulirish authored
71
72 # JavaScript
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
73 # Normalize to standard type (it's sniffed in IE anyways)
b14b4a6 @paulirish Normalize javascript mimetype to application/javascript. Reduces cruf…
paulirish authored
74 # tools.ietf.org/html/rfc4329#section-7.2
75 AddType application/javascript js
76
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
77 # Audio
e2c718c @bentruyman According to RFC 5334 ( http://tools.ietf.org/html/rfc5334 ), the 'ogg'
bentruyman authored
78 AddType audio/ogg oga ogg
a30e338 Added m4a (Need it for IE9) and m4v (HandBrake default) MIME types.
Steve Heffernan authored
79 AddType audio/mp4 m4a
e2c718c @bentruyman According to RFC 5334 ( http://tools.ietf.org/html/rfc5334 ), the 'ogg'
bentruyman authored
80
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
81 # Video
e2c718c @bentruyman According to RFC 5334 ( http://tools.ietf.org/html/rfc5334 ), the 'ogg'
bentruyman authored
82 AddType video/ogg ogv
a30e338 Added m4a (Need it for IE9) and m4v (HandBrake default) MIME types.
Steve Heffernan authored
83 AddType video/mp4 mp4 m4v
5be6f1f @paulirish ico serving, webp, and other bits. thx iszak
paulirish authored
84 AddType video/webm webm
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
85
b14b4a6 @paulirish Normalize javascript mimetype to application/javascript. Reduces cruf…
paulirish authored
86 # SVG.
87 # Required for svg webfonts on iPad
6f01f43 @paulirish webfont serving types.
paulirish authored
88 # twitter.com/FontSquirrel/status/14855840545
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
89 AddType image/svg+xml svg svgz
5be6f1f @paulirish ico serving, webp, and other bits. thx iszak
paulirish authored
90 AddEncoding gzip svgz
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
91
92 # Webfonts
5be6f1f @paulirish ico serving, webp, and other bits. thx iszak
paulirish authored
93 AddType application/vnd.ms-fontobject eot
ddd7ae4 @mikealmond Updating TTF mimetype to fix Google Chrome warning
mikealmond authored
94 AddType application/x-font-ttf ttf ttc
5be6f1f @paulirish ico serving, webp, and other bits. thx iszak
paulirish authored
95 AddType font/opentype otf
2404601 updated woff mime-type in ExpiresByType rule in .htaccess. fixes #349
Divya Manian authored
96 AddType application/x-font-woff woff
5be6f1f @paulirish ico serving, webp, and other bits. thx iszak
paulirish authored
97
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
98 # Assorted types
37b5fec @paulirish changing mimetype of .ico files to "image/x-icon". Details follow:
paulirish authored
99 AddType image/x-icon ico
5be6f1f @paulirish ico serving, webp, and other bits. thx iszak
paulirish authored
100 AddType image/webp webp
de50e81 @mathiasbynens Use the .appcache extension instead of .manifest, as per http://html5…
mathiasbynens authored
101 AddType text/cache-manifest appcache manifest
5be6f1f @paulirish ico serving, webp, and other bits. thx iszak
paulirish authored
102 AddType text/x-component htc
103 AddType application/x-chrome-extension crx
3d95cfa @dustinwhittle added plugin/extension mime types for safari, chrome, firefox
dustinwhittle authored
104 AddType application/x-xpinstall xpi
105 AddType application/octet-stream safariextz
fc7d9e1 @leobetosouza Allow blackberry to read vcards
leobetosouza authored
106 AddType text/x-vcard vcf
6f01f43 @paulirish webfont serving types.
paulirish authored
107
280b11a @paulirish htaccess: serving of htc. fixes #55
paulirish authored
108
9b5d916 @redoPop Make sure mod_deflate is enabled before attempting to use it.
redoPop authored
109
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
110 # ----------------------------------------------------------------------
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
111 # Allow concatenation from within specific js and css files
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
112 # ----------------------------------------------------------------------
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
113
114 # e.g. Inside of script.combined.js you could have
eebdfff @sams minor alteration to ssi js include illustrate that path should be rel…
sams authored
115 # <!--#include file="libs/jquery-1.5.0.min.js" -->
116 # <!--#include file="plugins/jquery.idletimer.js" -->
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
117 # and they would be included into this single file.
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
118
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
119 # This is not in use in the boilerplate as it stands. You may
120 # choose to name your files in this way for this advantage or
121 # concatenate and minify them manually.
43abda8 @paulirish ServerSideIncludes disabled by default. Strengthened them up, too. fi…
paulirish authored
122 # Disabled by default.
123
a36c13a @paulirish update the (disabled) SSI for better windows compatibility. fixes #628.…
paulirish authored
124 #<FilesMatch "\.combined\.js$">
125 # Options +Includes
126 # AddOutputFilterByType INCLUDES application/javascript application/json
127 # SetOutputFilter INCLUDES
6241a72 Fixing typo in .htaccess file
Divya Manian authored
128 #</FilesMatch>
a36c13a @paulirish update the (disabled) SSI for better windows compatibility. fixes #628.…
paulirish authored
129 #<FilesMatch "\.combined\.css$">
130 # Options +Includes
131 # AddOutputFilterByType INCLUDES text/css
132 # SetOutputFilter INCLUDES
133 #</FilesMatch>
0bb9495 @paulirish new .htaccess template with some common settings.. still need to be r…
paulirish authored
134
135
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
136 # ----------------------------------------------------------------------
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
137 # Gzip compression
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
138 # ----------------------------------------------------------------------
0bb9495 @paulirish new .htaccess template with some common settings.. still need to be r…
paulirish authored
139
9b5d916 @redoPop Make sure mod_deflate is enabled before attempting to use it.
redoPop authored
140 <IfModule mod_deflate.c>
141
a87078d @mathiasbynens Cleaner, more obvious indentation in .htaccess. Closes #817.
mathiasbynens authored
142 # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
143 <IfModule mod_setenvif.c>
144 <IfModule mod_headers.c>
145 SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
146 RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
147 </IfModule>
c3175aa @timemachine3030 check for mod_headers before calling RequestHeaders
timemachine3030 authored
148 </IfModule>
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
149
a87078d @mathiasbynens Cleaner, more obvious indentation in .htaccess. Closes #817.
mathiasbynens authored
150 # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
151 <IfModule filter_module>
152 FilterDeclare COMPRESS
153 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
154 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
155 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
156 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
157 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
158 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
159 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
160 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
161 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
162 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
163 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
164 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
165 FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
166 FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon
167 FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
168 FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
169 FilterChain COMPRESS
170 FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
171 </IfModule>
168d2eb @adeelejaz Use mod_filter for compression, with fallback to AddOutputFilterByTyp…
adeelejaz authored
172
a87078d @mathiasbynens Cleaner, more obvious indentation in .htaccess. Closes #817.
mathiasbynens authored
173 <IfModule !mod_filter.c>
174 # Legacy versions of Apache
175 AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
176 AddOutputFilterByType DEFLATE application/javascript
177 AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
178 AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
179 AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
180 </IfModule>
0bb9495 @paulirish new .htaccess template with some common settings.. still need to be r…
paulirish authored
181
a87078d @mathiasbynens Cleaner, more obvious indentation in .htaccess. Closes #817.
mathiasbynens authored
182 </IfModule>
0bb9495 @paulirish new .htaccess template with some common settings.. still need to be r…
paulirish authored
183
9c1fbb3 @paulirish svg serving addressed for webfonts on ipad
paulirish authored
184
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
185 # ----------------------------------------------------------------------
186 # Expires headers (for better cache control)
187 # ----------------------------------------------------------------------
188
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
189 # These are pretty far-future expires headers.
190 # They assume you control versioning with cachebusting query params like
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
191 # <script src="application.js?20100608">
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
192 # Additionally, consider that outdated proxies may miscache
44e49f8 @paulirish more detail around filename revving aka cachebusting
paulirish authored
193 # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
194
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
195 # If you don't use filenames to version, lower the CSS and JS to something like
196 # "access plus 1 week" or so.
44e49f8 @paulirish more detail around filename revving aka cachebusting
paulirish authored
197
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
198 <IfModule mod_expires.c>
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
199 ExpiresActive on
4e17c6d @paulirish expires rules mucking. other htaccess whitespace.
paulirish authored
200
201 # Perhaps better to whitelist expires rules? Perhaps.
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
202 ExpiresDefault "access plus 1 month"
203
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
204 # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
b6d10ae @paulirish cache manifest needs 0 expires (thx remy).
paulirish authored
205 ExpiresByType text/cache-manifest "access plus 0 seconds"
206
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
207 # Your document html
ec1bf21 @paulirish data (json/xml) should not be cached (good tip, SirFunk)
paulirish authored
208 ExpiresByType text/html "access plus 0 seconds"
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
209
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
210 # Data
ec1bf21 @paulirish data (json/xml) should not be cached (good tip, SirFunk)
paulirish authored
211 ExpiresByType text/xml "access plus 0 seconds"
212 ExpiresByType application/xml "access plus 0 seconds"
213 ExpiresByType application/json "access plus 0 seconds"
214
acdae81 @Phize add settings for Atom.
Phize authored
215 # Feed
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
216 ExpiresByType application/rss+xml "access plus 1 hour"
acdae81 @Phize add settings for Atom.
Phize authored
217 ExpiresByType application/atom+xml "access plus 1 hour"
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
218
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
219 # Favicon (cannot be renamed)
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
220 ExpiresByType image/x-icon "access plus 1 week"
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
221
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
222 # Media: images, video, audio
b59c1cc @adeelejaz Add Expires header for .gif
adeelejaz authored
223 ExpiresByType image/gif "access plus 1 month"
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
224 ExpiresByType image/png "access plus 1 month"
225 ExpiresByType image/jpg "access plus 1 month"
226 ExpiresByType image/jpeg "access plus 1 month"
227 ExpiresByType video/ogg "access plus 1 month"
228 ExpiresByType audio/ogg "access plus 1 month"
229 ExpiresByType video/mp4 "access plus 1 month"
e24de7f @paulirish expires for webm. hattip kroc camen.
paulirish authored
230 ExpiresByType video/webm "access plus 1 month"
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
231
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
232 # HTC files (css3pie)
2fe0b74 @paulirish caching of .htc files. thx rich. fixes #303
paulirish authored
233 ExpiresByType text/x-component "access plus 1 month"
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
234
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
235 # Webfonts
715957b @mathiasbynens Correct Expires header to `application/x-font-ttf`. Fixes #740.
mathiasbynens authored
236 ExpiresByType application/x-font-ttf "access plus 1 month"
2c0dce9 @paulirish fix up mimetypes for expires on webfonts. thx Holek.
paulirish authored
237 ExpiresByType font/opentype "access plus 1 month"
2404601 updated woff mime-type in ExpiresByType rule in .htaccess. fixes #349
Divya Manian authored
238 ExpiresByType application/x-font-woff "access plus 1 month"
44e49f8 @paulirish more detail around filename revving aka cachebusting
paulirish authored
239 ExpiresByType image/svg+xml "access plus 1 month"
5a8f128 @paulirish apache tricks from perishablepress. also a no-www fix from jstnryan
paulirish authored
240 ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
241
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
242 # CSS and JavaScript
96d7b26 @mdonoughe change the source htaccess rather than updating it
mdonoughe authored
243 ExpiresByType text/css "access plus 1 year"
244 ExpiresByType application/javascript "access plus 1 year"
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
245
5549551 @ashnur Bugfix. Header directive appeared without IfModule mod_headers.c caus…
ashnur authored
246 <IfModule mod_headers.c>
247 Header append Cache-Control "public"
248 </IfModule>
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
249
937fcf2 @paulirish updated htaccess. expires headers are better. better compression. mor…
paulirish authored
250 </IfModule>
1ca728c @paulirish p3p header for cookieable iframes (IE)
paulirish authored
251
252
253
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
254 # ----------------------------------------------------------------------
255 # ETag removal
256 # ----------------------------------------------------------------------
9b5d916 @redoPop Make sure mod_deflate is enabled before attempting to use it.
redoPop authored
257
9ee01e9 @shichuan moved ETag removal configs closer
shichuan authored
258 # FileETag None is not enough for every server.
259 <IfModule mod_headers.c>
260 Header unset ETag
261 </IfModule>
262
f5bc803 @redoPop Updated FileEtag directive per paulirish's comment here:
redoPop authored
263 # Since we're sending far-future expires, we don't need ETags for
264 # static content.
f33a07d @paulirish removing http:// from doc urls
paulirish authored
265 # developer.yahoo.com/performance/rules.html#etags
f5bc803 @redoPop Updated FileEtag directive per paulirish's comment here:
redoPop authored
266 FileETag None
08b7768 @redoPop Get your inodes the heck out of my ETags!
redoPop authored
267
268
269
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
270 # ----------------------------------------------------------------------
271 # Stop screen flicker in IE on CSS rollovers
272 # ----------------------------------------------------------------------
273
274 # The following directives stop screen flicker in IE on CSS rollovers - in
275 # combination with the "ExpiresByType" rules for images (see above). If
276 # needed, un-comment the following rules.
277
278 # BrowserMatch "MSIE" brokenvary=1
279 # BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
280 # BrowserMatch "Opera" !brokenvary
281 # SetEnvIf brokenvary 1 force-no-vary
282
283
284
285 # ----------------------------------------------------------------------
286 # Cookie setting from iframes
287 # ----------------------------------------------------------------------
08b7768 @redoPop Get your inodes the heck out of my ETags!
redoPop authored
288
401889b @paulirish apache config notes for iframe cookies
paulirish authored
289 # Allow cookies to be set from iframes (for IE only)
290 # If needed, uncomment and specify a path or regex in the Location directive
291
292 # <IfModule mod_headers.c>
293 # <Location />
154f5e1 @paulirish escaping fix in p3p section. (thx daniel harttman). fixed otfS typo. …
paulirish authored
294 # Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
401889b @paulirish apache config notes for iframe cookies
paulirish authored
295 # </Location>
296 # </IfModule>
1ca728c @paulirish p3p header for cookieable iframes (IE)
paulirish authored
297
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
298
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
299
300 # ----------------------------------------------------------------------
301 # Start rewrite engine
302 # ----------------------------------------------------------------------
303
304 # Turning on the rewrite engine is necessary for the following rules and features.
2833b89 @mathiasbynens Add `Options +FollowSymlinks` when `RewriteEngine` is used. Fixes #489.
mathiasbynens authored
305 # FollowSymLinks must be enabled for this to work.
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
306
7827a90 @paulirish nerfing the rewrite rules with ifModule. thx meander
paulirish authored
307 <IfModule mod_rewrite.c>
2833b89 @mathiasbynens Add `Options +FollowSymlinks` when `RewriteEngine` is used. Fixes #489.
mathiasbynens authored
308 Options +FollowSymlinks
7827a90 @paulirish nerfing the rewrite rules with ifModule. thx meander
paulirish authored
309 RewriteEngine On
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
310 </IfModule>
311
312
313
314 # ----------------------------------------------------------------------
315 # Suppress or force the "www." at the beginning of URLs
316 # ----------------------------------------------------------------------
317
318 # The same content should never be available under two different URLs - especially not with and
319 # without "www." at the beginning, since this can cause SEO problems (duplicate content).
320 # That's why you should choose one of the alternatives and redirect the other one.
321
322 # By default option 1 (no "www.") is activated. Remember: Shorter URLs are sexier.
323 # no-www.org/faq.php?q=class_b
324
325 # If you rather want to use option 2, just comment out all option 1 lines
326 # and uncomment option 2.
327 # IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
328
329 # ----------------------------------------------------------------------
330
331 # Option 1:
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
332 # Rewrite "www.example.com -> example.com"
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
333
334 <IfModule mod_rewrite.c>
5a8f128 @paulirish apache tricks from perishablepress. also a no-www fix from jstnryan
paulirish authored
335 RewriteCond %{HTTPS} !=on
7827a90 @paulirish nerfing the rewrite rules with ifModule. thx meander
paulirish authored
336 RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
00d8b84 @ngryman generic rewrite rules (working in virtual host context)
ngryman authored
337 RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
7827a90 @paulirish nerfing the rewrite rules with ifModule. thx meander
paulirish authored
338 </IfModule>
430ee89 @paulirish forward www.example.com to example.com by default.
paulirish authored
339
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
340 # ----------------------------------------------------------------------
341
342 # Option 2:
c72a81c @mathiasbynens Use example.com instead of domain.com, as per RFC 2606. Fixes #613.
mathiasbynens authored
343 # To rewrite "example.com -> www.example.com" uncomment the following lines.
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
344 # Be aware that the following rule might not be a good idea if you
345 # use "real" subdomains for certain parts of your website.
346
347 # <IfModule mod_rewrite.c>
348 # RewriteCond %{HTTPS} !=on
349 # RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
00d8b84 @ngryman generic rewrite rules (working in virtual host context)
ngryman authored
350 # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
351 # </IfModule>
352
353
354
355 # ----------------------------------------------------------------------
e81479b @paulirish add filename revving mapped to real asset into htaccess. (disabled by…
paulirish authored
356 # Built-in filename-based cache busting
357 # ----------------------------------------------------------------------
358
359 # If you're not using the build script to manage your filename version revving,
360 # you might want to consider enabling this, which will route requests for
caeb913 @MarceI Description corrections for "Built-in filename-based cache busting" s…
MarceI authored
361 # /css/style.20110203.css to /css/style.css
e81479b @paulirish add filename revving mapped to real asset into htaccess. (disabled by…
paulirish authored
362
363 # To understand why this is important and a better idea than all.css?v1231,
4a69c41 @necolas Update urls in .htaccess to reference the new repo and wiki locations
necolas authored
364 # read: github.com/h5bp/html5-boilerplate/wiki/Version-Control-with-Cachebusting
e81479b @paulirish add filename revving mapped to real asset into htaccess. (disabled by…
paulirish authored
365
366 # Uncomment to enable.
367 # <IfModule mod_rewrite.c>
368 # RewriteCond %{REQUEST_FILENAME} !-f
369 # RewriteCond %{REQUEST_FILENAME} !-d
370 # RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
371 # </IfModule>
372
373
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
374
e81479b @paulirish add filename revving mapped to real asset into htaccess. (disabled by…
paulirish authored
375 # ----------------------------------------------------------------------
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
376 # Prevent SSL cert warnings
377 # ----------------------------------------------------------------------
378
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
379 # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
c72a81c @mathiasbynens Use example.com instead of domain.com, as per RFC 2606. Fixes #613.
mathiasbynens authored
380 # https://www.example.com when your cert only allows https://secure.example.com
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
381 # Uncomment the following lines to use this feature.
382
383 # <IfModule mod_rewrite.c>
384 # RewriteCond %{SERVER_PORT} !^443
00d8b84 @ngryman generic rewrite rules (working in virtual host context)
ngryman authored
385 # RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
386 # </IfModule>
387
388
389
390 # ----------------------------------------------------------------------
391 # Prevent 404 errors for non-existing redirected folders
392 # ----------------------------------------------------------------------
393
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
394 # without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
6ce800b @paulirish tweaks to avoid apache errors a bit more.
paulirish authored
395 # e.g. /blog/hello : webmasterworld.com/apache/3808792.htm
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
396
b44a12d @mathiasbynens Enable gzip compression for favicons. Closes #684.
mathiasbynens authored
397 Options -MultiViews
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
398
399
400
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
401 # ----------------------------------------------------------------------
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
402 # Custom 404 page
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
403 # ----------------------------------------------------------------------
404
3a41223 @paulirish note: you can add page handlers for 500, 403 errors easily. fixes #299
paulirish authored
405 # You can add custom pages to handle 500 or 403 pretty easily, if you like.
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
406 ErrorDocument 404 /404.html
407
408
409
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
410 # ----------------------------------------------------------------------
411 # UTF-8 encoding
412 # ----------------------------------------------------------------------
413
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
414 # Use UTF-8 encoding for anything served text/plain or text/html
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
415 AddDefaultCharset utf-8
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
416
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
417 # Force UTF-8 for a number of file formats
acdae81 @Phize add settings for Atom.
Phize authored
418 AddCharset utf-8 .html .css .js .xml .json .rss .atom
0b140cf @paulirish 404 document. lots of .htaccess work
paulirish authored
419
420
421
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
422 # ----------------------------------------------------------------------
423 # A little more security
424 # ----------------------------------------------------------------------
425
5a8f128 @paulirish apache tricks from perishablepress. also a no-www fix from jstnryan
paulirish authored
426
4ab1c3d @paulirish ServerTokens Prod added to htaccess. thx alrra.
paulirish authored
427 # Do we want to advertise the exact version number of Apache we're running?
428 # Probably not.
4971aa0 @paulirish servertokens doesnt work in .htaccess.. only httpd.conf.
paulirish authored
429 ## This can only be enabled if used in httpd.conf - It will not work in .htaccess
430 # ServerTokens Prod
4ab1c3d @paulirish ServerTokens Prod added to htaccess. thx alrra.
paulirish authored
431
432
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
433 # "-Indexes" will have Apache block users from browsing folders without a default document
63d8a6c @paulirish tightening up michael van laar's apache changes
paulirish authored
434 # Usually you should leave this activated, because you shouldn't allow everybody to surf through
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
435 # every folder on your server (which includes rather private places like CMS system folders).
85d8cc0 @mathiasbynens Check if mod_autoindex.c is available before disabling the Indexes op…
mathiasbynens authored
436 <IfModule mod_autoindex.c>
437 Options -Indexes
438 </IfModule>
63d8a6c @paulirish tightening up michael van laar's apache changes
paulirish authored
439
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
440
78f4ec5 @paulirish htaccess: block access to .git and .svn folders.
paulirish authored
441 # Block access to "hidden" directories whose names begin with a period. This
442 # includes directories used by version control systems such as Subversion or Git.
443 <IfModule mod_rewrite.c>
444 RewriteRule "(^|/)\." - [F]
445 </IfModule>
446
94712de @MichaelvanLaar .htaccess: some additional features and more structure for easier rea…
MichaelvanLaar authored
447
448 # If your server is not already configured as such, the following directive
449 # should be uncommented in order to set PHP's register_globals option to OFF.
450 # This closes a major security hole that is abused by most XSS (cross-site
451 # scripting) attacks. For more information: http://php.net/register_globals
452 #
453 # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
454 #
455 # Your server does not allow PHP directives to be set via .htaccess. In that
456 # case you must make this change in your php.ini file instead. If you are
457 # using a commercial web host, contact the administrators for assistance in
458 # doing this. Not all servers allow local php.ini files, and they should
459 # include all PHP configurations (not just this one), or you will effectively
460 # reset everything to PHP defaults. Consult www.php.net for more detailed
461 # information about setting PHP directives.
462
63d8a6c @paulirish tightening up michael van laar's apache changes
paulirish authored
463 # php_flag register_globals Off
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
464
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
465 # Rename session cookie to something else, than PHPSESSID
61557bb some more security for php
slavic authored
466 # php_value session.name sid
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
467
e13f5c4 @mathiasbynens Add a note saying `php_flag expose_php Off` should be moved to `php.i…
mathiasbynens authored
468 # Do not show you are using PHP
469 # Note: Move this line to php.ini since it won't work in .htaccess
61557bb some more security for php
slavic authored
470 # php_flag expose_php Off
63d8a6c @paulirish tightening up michael van laar's apache changes
paulirish authored
471
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
472 # Level of log detail - log all errors
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
473 # php_value error_reporting -1
474
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
475 # Write errors to log file
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
476 # php_flag log_errors On
477
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
478 # Do not display errors in browser (production - Off, development - On)
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
479 # php_flag display_errors Off
480
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
481 # Do not display startup errors (production - Off, development - On)
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
482 # php_flag display_startup_errors Off
483
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
484 # Format errors in plain text
6fee66d @paulirish more docs for php_flag html_errors Off. thx @leek. fixes #622
paulirish authored
485 # Note: Leave this setting 'On' for xdebug's var_dump() output
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
486 # php_flag html_errors Off
487
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
488 # Show multiple occurrence of error
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
489 # php_flag ignore_repeated_errors Off
490
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
491 # Show same errors from different sources
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
492 # php_flag ignore_repeated_source Off
493
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
494 # Size limit for error messages
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
495 # php_value log_errors_max_len 1024
496
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
497 # Don't precede error with string (doesn't accept empty string, use whitespace if you need)
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
498 # php_value error_prepend_string " "
499
bfe9a84 @disusered Modified htaccess for consistent capitalization and comment style
disusered authored
500 # Don't prepend to error (doesn't accept empty string, use whitespace if you need)
1a398b3 some more security for php - turn off error display and turn on error…
slavic authored
501 # php_value error_append_string " "
502
edf9c3f @codler httponly
codler authored
503 # Increase cookie security
504 <IfModule php5_module>
85d8cc0 @mathiasbynens Check if mod_autoindex.c is available before disabling the Indexes op…
mathiasbynens authored
505 php_value session.cookie_httponly true
acdae81 @Phize add settings for Atom.
Phize authored
506 </IfModule>
Something went wrong with that request. Please try again.