Apache Expires Headers with mod_expires
Quick example of how to set default expires headers. This will help prevent browsers from re-downloading the same images more than once and therefore reduce the load on your image server.
Put this in your .htaccess file:
<IfModule mod_expires.c> ExpiresActive on ExpiresByType image/gif "access plus 1 years" ExpiresByType image/jpeg "access plus 1 years" ExpiresByType image/png "access plus 1 years" ExpiresByType text/css "access plus 1 years" ExpiresByType text/js "access plus 1 years" ExpiresByType text/javascript "access plus 1 years" ExpiresByType application/javascript "access plus 1 years" ExpiresByType application/x-javascript "access plus 1 years" #ExpiresDefault "access plus 1 days" </IfModule>
Bookmark/Search this post with:

Comments
"To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future."
From the HTTP 1.1 RFC
Thanks for the tip. I have updated my rules to be only 1 year.
Post new comment