Disabling Cache on Linux Server

You can disable caching of files by adding this code to the bottom of .htaccess

<Files index.php>

FileETag None

Header unset ETag

Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"

Header set Pragma "no-cache"

Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"

</Files>


Alternatively to target a specific selection of files, ie. to cache images but nothing else (files that match 
html, htm, js, css, php will not be cached):


<filesMatch "\.(html|htm|js|css|php)$">

FileETag None

Header unset ETag

Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"

Header set Pragma "no-cache"

Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"

</filesMatch>

Was this answer helpful? 0 Users Found This Useful (0 Votes)