Skip to content

Instantly share code, notes, and snippets.

@aalmenar
Forked from bhollis/.htaccess
Created September 25, 2017 10:57
Show Gist options
  • Select an option

  • Save aalmenar/a409b73ef652d9c2322a315d3e2ca364 to your computer and use it in GitHub Desktop.

Select an option

Save aalmenar/a409b73ef652d9c2322a315d3e2ca364 to your computer and use it in GitHub Desktop.
Serving pre-gzipped assets from 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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment