Jump to content

Referral Redirection


ModGirl

Recommended Posts

Hi [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

I've just started learning PHP, and while I'm beginning to get the hang of it. I've realised I need a script within my header.php file that redirects certain referrers back to where they've originated from as .htaccess just doesn't seem to be doing the trick at all.

I have done numerous searches on a tonne of forums and search engines and only came across redirection after login scripts. I don't wish to make my site membership at this time, so login scripts etc are useless to me.

Could someone please point me in the right direction?

Thanks in advance!

Moddy
Link to comment
https://forums.phpfreaks.com/topic/10696-referral-redirection/
Share on other sites

[!--quoteo(post=378051:date=May 29 2006, 01:15 PM:name=s_bastian)--][div class=\'quotetop\']QUOTE(s_bastian @ May 29 2006, 01:15 PM) [snapback]378051[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Do you need to block certain users (eg: web spiders) or the fact that someones links to your pages? referrers work on this latter case, but if you need to block spiders the best option is to work out a robots.txt for you site...
[/quote]

The latter, I don't want to block - just want to redirect from certain referrers.
Link to comment
https://forums.phpfreaks.com/topic/10696-referral-redirection/#findComment-39925
Share on other sites

what you need to look at is $_SERVER['HTTP_REFERER']
this var states where connection comes from. You can put a filter that if referer is not internal or null the link is sent back. Or you can compile an array with a list of sites you want to "cut off", and then filter what can pass and what cannot.
You will then use the META REFRESH to redirect the page where you need, or an include() to load a warning page. Pay attention with a "total" filter, it will also block links coming from search engines result pages...
Link to comment
https://forums.phpfreaks.com/topic/10696-referral-redirection/#findComment-39929
Share on other sites

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.