Skip to content

Instantly share code, notes, and snippets.

@rxnlabs
Created April 30, 2014 18:37
Show Gist options
  • Save rxnlabs/efb36259524df392977d to your computer and use it in GitHub Desktop.
Save rxnlabs/efb36259524df392977d to your computer and use it in GitHub Desktop.
htaccess - cache static files for one month and add gzip for performance
#add caching headers for static files. tell browser to cache for one month
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
ExpiresActive On
ExpiresDefault A2592000
</FilesMatch>
#add gzip to site
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/plain text/html application/x-httpd-php-source
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE font/truetype application/x-font-ttf font/opentype application/x-font-otf
</IfModule>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment