Skip to content

Instantly share code, notes, and snippets.

@phluid61
Created March 24, 2014 22:14
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 phluid61/9750448 to your computer and use it in GitHub Desktop.
Save phluid61/9750448 to your computer and use it in GitHub Desktop.
offline compression in Apache
AddType text/html .html_gz
AddType text/javascript .js_gz
AddType text/css .css_gz
AddEncoding gzip .html_gz .css_gz .js_gz
IndexIgnore *_gz
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}_gz -f
RewriteRule ^(.+)\.(html|css|js)$ $1.$2_gz [E=no-gzip:1]
Header merge Vary "Accept-Encoding"
for f in $(find . -name '*.html' -or -name '*.css' -or -name '*.js') ; do
gzip -nc9 $f > ${f}_gz
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment