I recently downloaded the Google Page Speed plugin for Firefox. This is a great tool that can help you take advantage of every millisecond during page load. The downside is this tool can be somewhat vague in its recommendations and suggested fixes. One issue I was running into was “Leverage Browser Caching”. This basically means that different items on your page should have different expire times set. The Google doc that it links to doesn’t really tell you exactly what you need to do to differentiate caching among page items. After digging around I found a great solution using HTACCESS. Simply paste this little ditty into your HTACCESS file and fill in the expire times that you prefer.
<IfModule mod_expires.c> ExpiresActive On ExpiresByType text/html "access plus 1 seconds" ExpiresByType image/gif "access plus 1 weeks" ExpiresByType image/jpeg "access plus 1 weeks" ExpiresByType image/png "access plus 1 weeks" ExpiresByType image/x-icon "access plus 1 years" ExpiresByType text/css "access plus 1 weeks" ExpiresByType text/javascript "access plus 1 weeks" ExpiresByType application/x-javascript "access plus 1 weeks" ExpiresByType application/x-shockwave-flash "access plus 1 weeks" </IfModule>
Thats it! I hope this helps.
Tweet
The best way to contact me is through one of the networks on the left or by emailing me at
ericbieller [at] gmail [dot] com.