Skip to content

Instantly share code, notes, and snippets.

@brycefisher
Created June 8, 2013 07:24
Show Gist options
  • Select an option

  • Save brycefisher/5734403 to your computer and use it in GitHub Desktop.

Select an option

Save brycefisher/5734403 to your computer and use it in GitHub Desktop.
Supercharge your DIY CDN with mod_expires, mod_deflate, and then lock it down a bit.
# Security
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule \.bat$ - [R=404]
</IfModule>
# Leverage Browser Caching
<IfModule mod_expires.c>
# Enable Expirations
ExpiresActive On
# Default Expiration Time
ExpiresDefault "access plus 1 month"
# Expiration for Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# Expiration for CSS
ExpiresByType text/css "access plus 1 month"
# Expiration for JavaScript
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
# Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment