ModGirl Posted May 29, 2006 Share Posted May 29, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/10696-referral-redirection/ Share on other sites More sharing options...
s_bastian Posted May 29, 2006 Share Posted May 29, 2006 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 Link to comment https://forums.phpfreaks.com/topic/10696-referral-redirection/#findComment-39920 Share on other sites More sharing options...
ModGirl Posted May 29, 2006 Author Share Posted May 29, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/10696-referral-redirection/#findComment-39925 Share on other sites More sharing options...
s_bastian Posted May 29, 2006 Share Posted May 29, 2006 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... Quote Link to comment https://forums.phpfreaks.com/topic/10696-referral-redirection/#findComment-39929 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.