Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to cache a particular image on my website i.e the background image.

So far i only see options that allow you to define the format type(png|jpg|ico) is there anyway to let the browser cache the background

share|improve this question
up vote 5 down vote accepted

I use the following to set far future expiration dates for all media files:

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|ico|js|css|swf)(\.gz)?$">
Header set Expires "Thu, 15 Apr 2020 20:00:00 GMT"
Header unset ETag
FileETag None

and I'd recommend using it because it will help out on the bandwidth and speed front's but this code would allow you to set the expiry for a specific file.

<Files "test1.jpg">
  ExpiresActive On
  ExpiresDefault A60
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.