Created
March 24, 2014 22:14
-
-
Save phluid61/9750448 to your computer and use it in GitHub Desktop.
offline compression in Apache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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