Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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