If the pages you refer to are PHP files, they are usually not cached (from browser to browser), to avoid caching, create a file named global.php
and add the following content:
<?php
$g = gmdate('D, d M Y H:i:s');
header('Expires: ' . $g . ' GMT');
header('Last-Modified: ' . $g . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
And use include
to add this file to all your required PHP files, for example in index.php
<?php
include 'global.php';
...Resto arquivo...
Pages that are already cached will continue to expire, but as they expire they will never be cached again.
But I'll be honest, if they are PHP files it is very likely that you are already using headers to cache, maybe you are using some framework and this has no way of responding.
Another possibility is that there is some .htaccess
file that is causing this.
If the code above quoted does not work please edit your question and add details. Hope it helps.
If the case is of static files, such as .js
, .css
, .html
, .jpg
, etc. you can use .htaccess
itself to prevent caching (although I do not recommend it, since static files rarely have modifications and it would be best to use caches in them). Example ( SOen ):
<filesMatch "\.(?i:html|htm)$">
FileETag None
<ifModule mod_headers.c>
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"
</ifModule>
</filesMatch>
In this example only the file .html
and .htm
will not be cached.
Reported: If-modified-since can be used with "304 not modified "Without PHP