Maarten Bruins
asked on
Preventing caching via .htaccess file (Apache)?
To completely prevent caching (storing it and using it), usually on the internet they are saying you have to use something like this in your .htaccess file:
I see this everywhere, but I don't understand it. What's the difference between the code above and this:
In my opinion you could use the last one. There is already "no-cache", so there will be anyway (re)validation. So "max-age=0", "must-revalidate", and "Expires" makes no sense to me?
So for what reason exactly people are adding those things to the .htaccess file?
<ifModule mod_headers.c>
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>
I see this everywhere, but I don't understand it. What's the difference between the code above and this:
<ifModule mod_headers.c>
Header set Cache-Control "no-cache, no-store"
Header set Pragma "no-cache"
</ifModule>
In my opinion you could use the last one. There is already "no-cache", so there will be anyway (re)validation. So "max-age=0", "must-revalidate", and "Expires" makes no sense to me?
So for what reason exactly people are adding those things to the .htaccess file?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I can not leave the question open? I think this is the right answer, but if someone wants to add something more then it's not possible anymore, because the topic is closed? Looks kind of weird to me ...
ASKER
Kind of weird to see how people are just copy / pasting (especially in tutorials) without thinking. But nothing to do about.
Thanks anyway for the explanation and quick answer!