Skip to content

Instantly share code, notes, and snippets.

@kauhat
Last active July 29, 2016 18:05
Show Gist options
  • Save kauhat/cc2e4074efbf6464689c to your computer and use it in GitHub Desktop.
Save kauhat/cc2e4074efbf6464689c to your computer and use it in GitHub Desktop.
Compress & cache
# Add correct content types for fonts
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/x-woff .woff
AddType image/svg+xml .svg
# Enable keep-alive if we can
<IfModule mod_headers.c>
Header set Connection keep-alive
</IfModule>
# Compress everything with merciless abandon
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript font/ttf font/otf image/svg+xml
</ifmodule>
# Cache everything with merciless abandon
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 year"
# Images
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# Fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/x-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment