Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
add comment

1 Answer 1

up vote 4 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
</FilesMatch>

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
</Files>
share|improve this answer
add comment

Your Answer

 
discard

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.