Reputation: 53
I have structure
/media
images
file1_dis.jpg
file2_dis.jpg
....
other_images
subfolders
file1_en.jpg
file2_en.jpg
I want enable caching for all files in subfolders, but disable caching for files in folder /media/images
Structure of site i cant't change.
Now i have code in .htaccess
<FilesMatch "\.(jpg|jpeg|png|gif)$">
Header set Expires "Thu, 15 Apr 3015 20:00:00 GMT"
</FilesMatch>
its enable caching for all images on my site.
Upvotes: 3
Views: 16174
Reputation: 4610
1) You should put .htaccess with code
<FilesMatch "\.(jpg|jpeg|png|gif)$">
Header set Expires "Thu, 15 Apr 3015 20:00:00 GMT"
</FilesMatch>
in folder other_images
2) You can use directive DirectoryMatch
Upvotes: 5
Reputation: 2304
insert a file into the subfolder with content you want NOT CACHE as follows
file name
.htaccess
contents of this file:
<IfModule mod_expires.c>
# disable caching forthis directory mod_expires for this directory
ExpiresActive off
</IfModule>
For detailed information: http://static.askapache.com/httpd/modules/mod_expires.c
For MORE detail information: http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html#mod_expires_Caching_EX-_1
Upvotes: 5