Skip to content

Instantly share code, notes, and snippets.

@n8kowald
Created February 20, 2013 17:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n8kowald/4997158 to your computer and use it in GitHub Desktop.
Save n8kowald/4997158 to your computer and use it in GitHub Desktop.
.htaccess - Improve performance by copying and pasting this into your .htaccess (or better yet your VirtualHost config)
# Compress text, html, javascript, css, xml:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
# Set up caching on media files for 1 week
<filesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A604800
</filesMatch>
# Set up caching on media files for 1 week
<filesMatch "\.(gif|jpg|jpeg|png|swf)$">
ExpiresDefault A604800
</filesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment