Created
October 23, 2012 22:34
-
-
Save shane-reaume/3942169 to your computer and use it in GitHub Desktop.
Better htaccess cache handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_headers.c> | |
Header unset ETag | |
Header unset Last-Modified | |
</IfModule> | |
FileETag None | |
<FilesMatch "\.(ico|gz|JPG|jpg|jpeg|png|gif|js|css|swf)$"> | |
Header unset Cache-control | |
Header set Expires "access plus 1 month" | |
</FilesMatch> | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType text/css A31536000 | |
ExpiresByType application/x-javascript A31536000 | |
ExpiresByType text/x-component A31536000 | |
ExpiresByType text/html A3600 | |
ExpiresByType image/bmp A31536000 | |
ExpiresByType application/java A31536000 | |
ExpiresByType image/gif A31536000 | |
ExpiresByType application/x-gzip A31536000 | |
ExpiresByType image/x-icon A31536000 | |
ExpiresByType image/jpeg A31536000 | |
ExpiresByType image/png A31536000 | |
ExpiresByType application/zip A31536000 | |
</IfModule> | |
<IfModule mod_mime.c> | |
AddType text/css .css | |
AddType application/x-javascript .js | |
AddType image/gif .gif | |
AddType application/x-gzip .gz .gzip | |
AddType image/x-icon .ico | |
AddType image/jpeg .jpg .jpeg .jpe | |
</IfModule> | |
<IfModule mod_deflate.c> | |
<IfModule mod_setenvif.c> | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header append Vary User-Agent env=!dont-vary | |
</IfModule> | |
<IfModule mod_filter.c> | |
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon | |
</IfModule> | |
</IfModule> | |
<FilesMatch "\.(css|js|htc|CSS|JS|HTC)$"> | |
<IfModule mod_headers.c> | |
Header set Pragma "public" | |
Header append Cache-Control "public, must-revalidate, proxy-revalidate" | |
</IfModule> | |
FileETag None | |
<IfModule mod_headers.c> | |
Header set X-Powered-By "W3 Total Cache/0.9.2.4" | |
</IfModule> | |
</FilesMatch> | |
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$"> | |
<IfModule mod_headers.c> | |
Header set Pragma "public" | |
Header append Cache-Control "public, must-revalidate, proxy-revalidate" | |
</IfModule> | |
FileETag None | |
<IfModule mod_headers.c> | |
Header set X-Powered-By "W3 Total Cache/0.9.2.4" | |
</IfModule> | |
</FilesMatch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment