Jump to content

Redirect Based On Refer website


mikem562

Recommended Posts

Hello, This is what I'm trying to-do. I have an index.php file I would like a bit of code that says

 

"If you got here from www.websitea.com (or a link within that site) OR www.websiteb.com"

do this :

else

do this:

 

I'm just not sure how to check where they're coming from.

so basically if your on google.ca and you goto the site it will exicute the else part of the code

but if your already on sitea or b and you click a link it will not

Link to comment
https://forums.phpfreaks.com/topic/247972-redirect-based-on-refer-website/
Share on other sites

I found this which I think is what I'm looking for (or something similar)

 

if( (strpos($_SERVER['HTTP_REFERER'], get_bloginfo('home')) === false) && !$_SERVER['QUERY_STRING'])

but I'm not sure how to make it, if www.sitea.com = false or siteb.com = false & your not coming from within the site itself then ...

else etc

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.