Skip to content

Instantly share code, notes, and snippets.

@tomhayes
Last active January 20, 2017 02:31
Show Gist options
  • Save tomhayes/72e5e09d217682816e358ec43ea3d281 to your computer and use it in GitHub Desktop.
Save tomhayes/72e5e09d217682816e358ec43ea3d281 to your computer and use it in GitHub Desktop.
Enable GZIP Compression (.htaccess)
<IfModule mod_deflate.c>
# Insert filters
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
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml
# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment