I need to show my users a slightly different version of the front-page before opening date. The idea was to redirect them to home.html
in the index.php
(the main-site) by using header("location:home.html")
, and after the opening, remove that redirect so they load the real index.php
.
The problem is, if I do that, will the browser cache the redirect and take them to cached version of home.html
even after I have removed the redirect from the index.php
? If so, how do I prevent that?
The end goal is, show the user uncached brand new version of the site after opening date.
There are multiple kinds of redirections. You want a temporary.
header("HTTP/1.1 307 Temporary Redirect");
header("Location: https://example.com/home.php");
PHP is not caching redirects, but the browser may. So when used temporary it won't.