I’m trying to cache some files using a .htaccess file for Apache2. I want to cache a particular folder longer than anything else, so i’ve been trying to use the FilesMatch directive like this:
<FilesMatch "skins(.*)\.(jpg|png|gif)">
ExpiresDefault A2592000
</FilesMatch>
I’m hoping to be able to cache all image files in the /skins/ directory and it’s subdirectories. However, I can’t quite get the regular expression to work – Apache just ignores it altogether.
How do you match a folder with <FilesMatch> in a .htaccess file?
Cheers,
Matt
FilesMatch should only match filenames. You can place the
.htaccessfile inside theskinsdirectory and it should look something like this:Alternatively, in
httpd.conf, you could use:Good luck.