Forum Moderators: coopster

Message Too Old, No Replies

Prevent page caching

Any way to absolutely stop web pages being cached

         

ThirdWheel

10:00 am on Jun 25, 2008 (gmt 0)

10+ Year Member



Hi,

I need to prevent any of my pages being cached. All of my pages begin as follows ...

<?
header("cache-control: no-cache, no-store");
?>

However, I understand this isn't respected by all browsers. Anyone know a way to ensure no pages are cached?

Thanks,

Dick

NomikOS

1:25 pm on Jun 25, 2008 (gmt 0)

10+ Year Member



<?php 
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
?>

look at this: [mnot.net...]
it's there a PHP secction at the end of the page.-

look too for some sessions functions like session_cache_limiter() && session_cache_expire()

[edited by: NomikOS at 1:29 pm (utc) on June 25, 2008]

ThirdWheel

1:32 pm on Jun 25, 2008 (gmt 0)

10+ Year Member



Many thanks, NomikOS.