Any help would be much appreciated.
I am trying to redirect users based on the referring url. I've got it working based one the referring domain, but I want it to work when a query string is attached to the domain.
This is what I have so far.
PHP Code:
<?
$referrer = $_SERVER['HTTP_REFERER'];
if (preg_match("/[login to view URL]",$referrer)) {
header('Location: [login to view URL]');
} else {
header('Location: [login to view URL]');
};
?>
This is what I want to happen, but I know this is not how to do it:
PHP Code:
<?
$referrer = $_SERVER['HTTP_REFERER'];
if (preg_match("/[login to view URL]",$referrer)) {
header('Location: [login to view URL]');
} else {
header('Location: [login to view URL]');
};
?>
I want to only show [login to view URL] if the referrer is [login to view URL] (which includes anything that follows 'url?q=')
If the referrer is anything other than [login to view URL] or even just [login to view URL] i want the user to go to [login to view URL]
So, a recap:
I want user to go to WebsiteA if referrer is something like [login to view URL]
I want the user to go to WebsiteB if referrer is anything else, even if the referrer is only [login to view URL] i want them to go to WebsiteB
Thank you for your help!