Is checking the referer header a reliable method in PHP to prevent a page from being loaded from the cache?
Checking the referer header in PHP is not a reliable method to prevent a page from being loaded from the cache as the referer header can be easily manipulated or spoofed. A more reliable method is to set appropriate cache control headers in the response to instruct browsers and proxies not to cache the page.
// Set cache control headers to prevent caching
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");