Skip to content

Instantly share code, notes, and snippets.

@cantlin
Created October 3, 2012 16:01
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 cantlin/3827806 to your computer and use it in GitHub Desktop.
Save cantlin/3827806 to your computer and use it in GitHub Desktop.
# Make sure we have MIME types set up for WOFF, EOT and TT fonts.
# Existing mappings for these extensions are overridden.
AddType application/font-woff .woff # http://www.w3.org/TR/WOFF
AddType application/x-font-ttf .ttf # No standard type for TT
AddType application/vnd.ms-fontobject .eot # iana.org/assignments/media-types/application
# Ensure the JS MIME type is set to what we expect.
AddType application/javascript .js
# Enable gzip compression using mod_deflate.
# WOFF files are already compressed (http://en.wikipedia.org/wiki/Web_Open_Font_Format).
AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf
# Set charset=utf-8 in the `Content-Type` response header.
AddDefaultCharset utf-8
# Turn on `Expires` headers and set up type-based expiry/max-age.
ExpiresActive On
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
# We generally use URI-based version bumps to expire Javascript and CSS.
ExpiresByType text/css "access plus 3 months"
ExpiresByType application/javascript "access plus 3 months"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment