Skip to content

Instantly share code, notes, and snippets.

@jondueck
Last active October 29, 2015 15:07
Show Gist options
  • Save jondueck/14b75072692a0828219f to your computer and use it in GitHub Desktop.
Save jondueck/14b75072692a0828219f to your computer and use it in GitHub Desktop.
htaccess Starter
RewriteEngine On
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC]
RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]
# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript image/svg+xml image/x-icon
</ifmodule>
# END GZIP
AddDefaultCharset utf-8
<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 image/svg "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType text/js "access 2 weeks"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 2 weeks"
ExpiresByType application/javascript "access 2 weeks"
ExpiresByType application/x-javascript "access 2 weeks"
ExpiresByType image/x-icon "access 1 month"
ExpiresByType image/svg+xml "access plus 2 weeks"
ExpiresDefault "access 2 days"
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment