Skip to content

Instantly share code, notes, and snippets.

@subhaze
Forked from bhollis/.htaccess
Last active August 29, 2015 14:07
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 subhaze/2f83e4fd267dcfe0ed1c to your computer and use it in GitHub Desktop.
Save subhaze/2f83e4fd267dcfe0ed1c to your computer and use it in GitHub Desktop.
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]
@subhaze
Copy link
Author

subhaze commented Oct 9, 2014

Adding comment from original Gist:

Also you should add:

<Files *.css.gz>
ForceType text/css
</Files>
<Files *.js.gz>
ForceType application/javascript
</Files>
<Files *.html.gz>
ForceType text/html
</Files>

or browsers will not recognize css

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