View Full Version : Redirecting googlebot in PHP
schlottke
Jun 16th 2004, 5:58 pm
If I want to redirect the googlebot for one page which includes ?ref=xxx to another that does not, what would the code look like to do this, without redirecting any visitors.
digitalpoint
Jun 16th 2004, 6:11 pm
Put this on your first line:
if (preg_match("#(google|slurp@inktomi|yahoo! slurp|msnbot)#si", $_SERVER['HTTP_USER_AGENT'])) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.new-location.com/");
exit;
}
That will do it for a few other bots too, not just Google.
john_loch
Jun 17th 2004, 2:25 am
If you want to redirect googlebot only, ensure you're a little more specific than just a referrer that contains 'google'. Referrers can include mediapartners-googlebot, google-proxy, etc etc.
:)
schlottke
Jun 17th 2004, 4:25 am
If Im redirecting traffic from index.php?ref=112 to index.php it redirects
http://www.jrwrestling.com/catalog/index.php/cPath/42 to
http://www.jrwrestling.com/catalog/index.php
Does it not?
digitalpoint
Jun 17th 2004, 8:31 am
Yeah, I would put a test for whatever you are looking for as the only thing you redirect.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.