I would like to "force-load" an instance of a page every time it's accessed.
The website in question is a "build your custom product"-kind of site and uses a multi-step form to guide customers through the steps of the product building. The client wants the site to be such that every time a user access the site, whether by direct url or by clicking on the "back" and "forward" buttons on the browser, it must refresh. In other words, no caching (right?).
I've tried to use the solutions I found on SO and on other websites, which mainly consisted of
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
But that didn't work.
So I tried my own solution:
$location = "/fabriquer/";
if(isset($_COOKIE['first_load']) && $_COOKIE['first_load'] == "true") {
setcookie('first_load', 'false');
header("Location: " . "http://" . $_SERVER['HTTP_HOST'] . $location);
} else {
setcookie('first_load', 'true');
}
But that also seems to not be working properly. When I press the back button on my browser to get back on that site, the refresh does not happen, but the cookie is set to true/false in the second solution.
Any ideas?