Jump to content


Photo

Referral Redirection


  • Please log in to reply
3 replies to this topic

#1 ModGirl

ModGirl
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 May 2006 - 11:14 AM

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

#2 s_bastian

s_bastian
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 29 May 2006 - 12:15 PM

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...

#3 ModGirl

ModGirl
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 May 2006 - 12:37 PM

[!--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) View Post[/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.

#4 s_bastian

s_bastian
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 29 May 2006 - 01:20 PM

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...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users