Skip to content

Instantly share code, notes, and snippets.

@blobaugh
Last active June 27, 2018 17:36
Show Gist options
  • Save blobaugh/17408feffad431e6bab15642bca93614 to your computer and use it in GitHub Desktop.
Save blobaugh/17408feffad431e6bab15642bca93614 to your computer and use it in GitHub Desktop.
Apache gzip and browser caching
# Enable browser caching.
<IfModule expires_module>
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 week"
# favicon
ExpiresByType image/x-icon "access plus 1 week"
# Images
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
# CSS
ExpiresByType text/css "access 1 day"
# Javascript
ExpiresByType application/javascript "access plus 1 day"
</IfModule>
# Enable GZIP compression.
<IfModule deflate_module>
<IfModule filter_module>
# favicon
AddOutputFilterByType DEFLATE image/x-icon
# CSS
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
# Fonts
AddOutputFilterByType DEFLATE font/opentype application/font-otf application/x-font-otf
AddOutputFilterByType DEFLATE font/truetype application/font-ttf application/x-font-ttf
# Documents
AddOutputFilterByType DEFLATE text/plain text/html
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
</IfModule>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment