How to disable caching of images in one folder, but enable all other folders

I have a structure

/media
    images
        file1_dis.jpg
        file2_dis.jpg
        .... 
        other_images
           subfolders
               file1_en.jpg
               file2_en.jpg

      

I want to enable caching for all files in subfolders, but disable caching of files in the folder / media / images

I cannot change the structure of the site.

Now I have the code in .htaccess

<FilesMatch "\.(jpg|jpeg|png|gif)$">
Header set Expires "Thu, 15 Apr 3015 20:00:00 GMT"
</FilesMatch>

      

caching it for all images on my site.

+3


source to share


2 answers


1) You have to put .htaccess with code

<FilesMatch "\.(jpg|jpeg|png|gif)$">
    Header set Expires "Thu, 15 Apr 3015 20:00:00 GMT"
</FilesMatch>

      



in the other_images folder

2) You can use DirectoryMatch directive

+4


source


paste the file into subfolder with content you want NOT QUALITY like below.

file name

.htaccess

content of this file:



<IfModule mod_expires.c>
# disable caching forthis directory mod_expires for this directory
ExpiresActive off
</IfModule>

      

For more details: http://static.askapache.com/httpd/modules/mod_expires.c

For more details: http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html#mod_expires_Caching_EX-_1

+4


source







All Articles