How To Download A Header Image Just Once

While checking links on a client’s re-vamped web site, I noticed that the header image would be re-loaded for each page visited on the site. I’d forgotten to set the .htaccess file with an Expires Header to ensure that the images would be downloaded just one time by a site visitor.

Making the content appear quickly in front of site visitors should be a goal for all site developers. And besides, reducing the load on your server is always a good idea, don’t you think?

To cache a header image, or other images for that matter, or to make sure that files aren’t downloaded too often, use an Expires Header in your .htaccess file.

#Expire Header
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 2 months"

Note that all types of image files, as well as stylesheets, javascript, flash and other file types, can be cached with this Expire Header.