Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude directory from browser caching with .htaccess

I have a .htaccess file that handles the browser caching. I set the rules with file extensions. How can I modify the following snippet to exclude a specific directory from the browser caching?

<FilesMatch "\.(gif|png|jpg|js|css|ico|woff|eot|svg|ttf)$">
    Header set Cache-Control "max-age=2592000, public, must-revalidate"
    Header unset Last-Modified
</FilesMatch>

I there any way to totally forbid the caching in this directory?

like image 217
Patartics Milán Avatar asked Nov 03 '22 22:11

Patartics Milán


1 Answers

You can try to overwrite parent cache function. Just replace another htaccess file under desired folder and set to cache for 1 sec. Worked for me.

ExpiresActive On
ExpiresDefault A1
Header append Cache-Control must-revalidate
like image 91
inovasyon Avatar answered Nov 09 '22 06:11

inovasyon