For security reasons, several articles recommend "do not cache pages". So I usually put the following at the beginning of my web pages
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
That works very well, but many of the visitors likes to use the history buttons. So, I need to allow it for a short period. I tried to use the following headers
header("Cache-Control: maxage=".$expires.", must-revalidate");
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
where $expires is the time I need. The problem is that pages do not expire, as if those headers were not there. How can I solve this?