Skip to content

Instantly share code, notes, and snippets.

@ryantownley
Last active June 5, 2016 19:53
Show Gist options
  • Save ryantownley/e11a208d0af465dbb4d2 to your computer and use it in GitHub Desktop.
Save ryantownley/e11a208d0af465dbb4d2 to your computer and use it in GitHub Desktop.
Expires cashing and compression code for speeding up your website.
# EXPIRES CACHING #
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 week"
ExpiresDefault "access 1 week"
</IfModule>
# EXPIRES CACHING #
# BEGIN COMPRESSION #
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentype
</IfModule>
# END COMPRESSION #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment