Patartics Milán
Patartics Milán

Reputation: 4948

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?

Upvotes: 5

Views: 3183

Answers (1)

inovasyon
inovasyon

Reputation: 460

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

Upvotes: 2

Related Questions