changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

Compress and Expire in Apache2

February 15, 2016 by The Man

This is so I can remember and copy/paste next time I need this. Add to your site.con

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE image/jpg
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE image/gif
AddOutputFilterByType DEFLATE image/jpeg
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/jpeg "access plus 60 days"
ExpiresByType text/css "access plus 1 days"
ExpiresByType image/x-icon "access plus 28 days"
ExpiresByType application/pdf "access plus 28 days"
ExpiresByType audio/x-wav "access plus 28 days"
ExpiresByType audio/mpeg "access plus 28 days"
ExpiresByType video/mpeg "access plus 28 days"
ExpiresByType video/mp4 "access plus 28 days"
ExpiresByType video/quicktime "access plus 28 days"
ExpiresByType video/x-ms-wmv "access plus 28 days"
ExpiresByType application/x-shockwave-flash "access 28 days"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
ExpiresByType application/javascript "access plus 7 days"