Skip to content

Instantly share code, notes, and snippets.

@alfredbez
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfredbez/81b60cbcfd907abf09c9 to your computer and use it in GitHub Desktop.
Save alfredbez/81b60cbcfd907abf09c9 to your computer and use it in GitHub Desktop.
use .gz version if available (works with js, css & html files)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule (.*)$ $1.gz [L]
</IfModule>
<FilesMatch ".(js.gz)$">
AddType text/javascript .gz
AddEncoding x-gzip .gz
</FilesMatch>
<FilesMatch ".(css.gz)$">
AddType text/css .gz
AddEncoding x-gzip .gz
</FilesMatch>
<FilesMatch ".(html.gz)$">
AddType text/html .gz
AddEncoding x-gzip .gz
</FilesMatch>
@alfredbez
Copy link
Author

I use gulp-gzip to generate the .gz-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment