I want to give different expiry headers to different images on my site. they are contained in different folders right now, what I want to do is give then different expires headers with one main .htaccess file. I know this can be done with multiple .htaccess files in those folders but I dont want it to be implemented that way, It will clearly be tough to manage.
views:
15answers:
1
A:
Try using FilesMatch directive in your .htaccess file.
Eg:
# cache most product images at client side
ExpiresActive on
<FilesMatch "^images/products/[^\.]*\.(gif|jpe?g|png)$">
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
Header append Cache-Control "public"
</FilesMatch>
EDIT: This seems to be wrong! FilesMatch is said to match only files, so you cannot match directories as well. Sorry for bad post.
xaralis
2010-08-18 08:45:12
yea that was the issue, i have come up with a solution btw will post it when i get time :)
Umair
2010-08-18 12:40:39