Skip to content

Instantly share code, notes, and snippets.

@ariela
Created May 20, 2011 05:32
Show Gist options
  • Save ariela/982410 to your computer and use it in GitHub Desktop.
Save ariela/982410 to your computer and use it in GitHub Desktop.
各リソースをgz圧縮して転送量を抑える
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME} !.gz$
RewriteCond %{REQUEST_FILENAME}.gz -s
RewriteRule .+ %{REQUEST_URI}.gz
<FilesMatch ".html.gz$">
ForceType text/html
AddEncoding x-gzip .gz
</FilesMatch>
<FilesMatch ".txt.gz$">
ForceType text/plain
AddEncoding x-gzip .gz
</FilesMatch>
<FilesMatch ".js.gz$">
ForceType application/x-javascript
AddEncoding x-gzip .gz
</FilesMatch>
<FilesMatch ".css.gz$">
ForceType text/css
AddEncoding x-gzip .gz
</FilesMatch>
</IfModule>
ExpiresActive on
ExpiresDefault "access plus 1 month"
FileETag None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment