Caching is good for you

I’ve asked Apache to start sending out Cache-Control and Expires headers for PNG and JPEG images. They are set to expire after one week — this means that your browser wont even try to load the images from my server until a week has passed. This should give you a more smooth browsing experience because the browser only fetches the XHTML.

The trick is very simple, just add the following to a .htaccess file:

<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType image/jpeg "now plus 1 week"
    ExpiresByType image/png "now plus 1 week"
</IfModule>

Also, I’ve turned indexes on in the /downloads/ directory — this is also very simple, just make a .htaccess file with

Options +Indexes

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI (optional)
Your Comment (smaller size | larger size)

Formatted using Markdown: use blank lines to separate paragraphs, * for emphasis, and backticks (`) around code.

(Googlebot visited this page Thursday, December 22, 2005)