My host's file structure looks like this:
.
./.htaccess
./index.html
./should-not-expire.png
./uploads/should-expire.png
./uploads/should-expire.jpg
How can I ensure that files under the uploads
directory are all served with a far future expires header, without serving such a header for index.html
or should-not-expire.png
?
I've reviewed the sections docs that discuss the <Directory>
, <Files>
, and <Location>
blocks, and it seems like Directory
and Location
are not allowed in .htaccess
, and Files
matches only the file name and not any part of the path. For instance, this directive doesn't seem to send the desired headers:
<FilesMatch "uploads">
ExpiresDefault A604800
</FilesMatch>
It seems like one resort would be to introduce another .htaccess
file in the uploads
directory. That seems to work fine, but is there any way to do this with just the sole .htaccess
?