Marius
Marius

Reputation: 413

Unwanted caching of web page

I have a problem of web pages being cached even though I specify that it should not. Take the simple example :

<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
</head>
<?php
    print date("Y/m/d H:i:s");
?>
</html>

Hitting refresh several times in my browser indicates that this page is not reloaded as the time stays the same. It will eventually refresh if I keep on hitting the refresh button in the browser. Where could this page be cached and how can I avoid it?

I'm using Apache 2.2.15, PHP 5.3.2 on openSuse 11.2, and my testing browser is Firefox 3.5.7 on the same machine.

Upvotes: 0

Views: 256

Answers (1)

zaf
zaf

Reputation: 23274

Have you tried using the no caching headers? e.g.:

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

Upvotes: 2

Related Questions