Devam Ediyor

341966 Need Help With PHP Redirect

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("/[url removed, login to view]",$referrer)) {

header('Location: [url removed, login to view]');

} else {

header('Location: [url removed, login to view]');

};

?>

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("/[url removed, login to view]",$referrer)) {

header('Location: [url removed, login to view]');

} else {

header('Location: [url removed, login to view]');

};

?>

I want to only show [url removed, login to view] if the referrer is [url removed, login to view] (which includes anything that follows 'url?q=')

If the referrer is anything other than [url removed, login to view] or even just [url removed, login to view] i want the user to go to [url removed, login to view]

So, a recap:

I want user to go to WebsiteA if referrer is something like [url removed, login to view]

I want the user to go to WebsiteB if referrer is anything else, even if the referrer is only [url removed, login to view] i want them to go to WebsiteB

Thank you for your help!

Beceriler: Her şey Kabul, PHP

Daha fazlasını görün: help with php, php http redirect, http redirect, redirect code, redirect url code, http redirect code, php url redirect, referrer code, redirect based referrer, php location based, domain help, recap, referring url, redirect url, redirect http, php preg_match php, preg_match, google redirect based location, based redirect domain, location based php, code php referrer, php redirect based, url redirect, redirect work php, php preg_match

İşveren Hakkında:
( 13 değerlendirme )

Proje NO: #2087784

Seçilen:

0 gün içinde 10$ USD
(0 Değerlendirme)
0.0