Skip to content

Instantly share code, notes, and snippets.

@Jeemusu
Created April 17, 2016 06:46
Show Gist options
  • Save Jeemusu/9165fe7f6287fa54b9489a4da81a5d4d to your computer and use it in GitHub Desktop.
Save Jeemusu/9165fe7f6287fa54b9489a4da81a5d4d to your computer and use it in GitHub Desktop.
Serve pre-gzip'd files (apache)
AddEncoding gzip .gz
RewriteEngine on
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Konqueror
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)\.css$ $1.css.gz [QSA,L]
RewriteRule ^(.*)\.js$ $1.js.gz [QSA,L]
RewriteRule ^(.*)\.html$ $1.html.gz [QSA,L]
<Files *.css.gz>
ForceType text/css
</Files>
<Files *.js.gz>
ForceType application/javascript
</Files>
<Files *.html.gz>
ForceType text/html
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment