Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dannyconnolly/8842767 to your computer and use it in GitHub Desktop.
Save dannyconnolly/8842767 to your computer and use it in GitHub Desktop.
htaccess rules for better page speed results
FileETag MTime Size
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|ico)$">
Header set Cache-Control "public"
Header set Expires "Thurs, 06 Jan 2016 14:30:00 GMT"
Header set Last-Modified "Thurs, 06 Jan 2014 14:30:00 GMT"
</FilesMatch>
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment