I am attempting to cache some files utilizing a .htaccess apply for Apache2. I wish to cache a specific folder more than other things, so i have been attempting to make use of the FilesMatch directive such as this:

<FilesMatch "skins(.*)\.(jpg|png|gif)">
ExpiresDefault A2592000
</FilesMatch>

I am wishing to have the ability to cache all image files within the /skins/ directory and it is subdirectories. However, I can not quite obtain the regular expression to operate - Apache just ignores it altogether.

How can you match a folder with <FilesMatch> inside a .htaccess file?

Cheers,
Matt

FilesMatch should only match filenames so You can put the .htaccess file within the "skins" directory also it need to look something similar to,

<FilesMatch "\.(jpg|png|gif)">
ExpiresDefault A2592000
</FilesMatch>

or maybe within the httpd.conf file you could utilize,

<Directory path_to_the_skins_dir>
    <FilesMatch "\.(jpg|png|gif)">
    ExpiresDefault A2592000
    </FilesMatch>
</Directory>

best of luck