I'm trying to receive the referrer URL. If an external website has a link to my website and someone clicks on that link, I want to receive (and save) that external website's URL. After clicks on my website, I still need that same referrer URL.
I've tried the following code:
<?php
if (isset($_SERVER['HTTP_REFERER'])) {
$refURL = $_SERVER['HTTP_REFERER'];
echo $refURL;
} else {
echo "No referer URL";
}
?>
But if you click on the link on the external website, it doesn't show anything. If I click on a link on my website, I always get the previous page.
It seems that I don't get the URL if I'm redirected from an external website.