Page optimization through expiration dates.

This is a tip to help speed up sites (as long as the server is Apache). Make sure you have mod_expire compiled in, then add this to the configuration file (httpd.conf):


ExpiresActive on
ExpiresByType text/css “access plus 6 month”
ExpiresByType image/png “access plus 6 month”
ExpiresByType image/gif “access plus 6 month”
ExpiresByType image/jpeg “access plus 6 month”

Once this is setup, restart Apache. Now the server will send images and style sheets (both of these types of files are usually large) with an Expires header. The header is set to 6 months after the user agent requests the object. People that frequent your site will notice a speed improvement since their browser will cache the aforementioned files. The only caveat is that if you modify CSS or image files you have to rename them and redo the links in your HTML code, but the tradeoff is worth it.

Leave a Comment