Forum Moderators: coopster

Message Too Old, No Replies

Cache busting

For sessions and otherwise

         

whoisgregg

5:57 pm on Nov 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So I have the need to prevent user caching on particular pages. I've read the manual pages on header [php.net] and session_cache_limiter [php.net].

Am I right to think that these snippets are ALL that I need to reliably prevent users from caching the pages?

When using sessions:

session_cache_limiter('nocache');
session_start();

When not using sessions:

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

I don't understand the comments on those manual pages about sending a dozen different headers. Are they all necessary? Or are they legacy hacks?

mcibor

2:02 pm on Nov 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



These headers you mentioned will do just fine.

The comments were mostly about making downloads, so don't worry.

Best regards
Michal Cibor

whoisgregg

9:22 pm on Nov 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Michal! :)