views:

214

answers:

1

All of the expires headers articles I've looked at give more or less the following solution:

ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000

But it doesn't make sense to me because I know which of my images are going to change and which aren't, so I want to be able to add specific expiration dates to specific image files. How would I go about this?

Thanks!

A: 

You can use a FilesMatch, eg.

<FilesMatch "\.(js|css)$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesMatch>

Or for some specific files:

<FilesMatch "^(example.js|sample.css)$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesMatch>
ar
Could you give an example of how to apply this to a specific image file: example.jpg ? Thanks!
j-man86
Thanks for your help ar, much appreciated: So would the following work?(image.jpg|anotherImage.png|backgroundImage.png|bannerImg.jpg)
j-man86
Adding this code to my .htaccess gave me a 500 internal server error.
j-man86