Forum Moderators: coopster

Message Too Old, No Replies

Detecting Google in a php script?

         

georgec

12:19 pm on Oct 2, 2003 (gmt 0)

10+ Year Member



Does anyone know how to detect if Google is the entity executing a script, such as a link redirect script? I wish to disable SEs (specifically Google) from crawling and visiting a list of sites that are sent off using a php script, ie:

header("Location: [target.com");...]

Thanks,

Nick_W

12:23 pm on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




if(!strstr($_SERVER['HTTP_USER_AGENT'],"Googlebot")) {
header('location.php');
}

Nick

georgec

1:01 pm on Oct 2, 2003 (gmt 0)

10+ Year Member



Thanks for the response. Is it just "Googlebot", or should I be searching for variations as well, such as low caps "G" among others?

Thanks,

Nick_W

3:42 pm on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well AFAIK Gbot always identifies itself as the above...

I wrote a function for this that includes other SE's aswell but I'm damned if I can find it... UKGimp may have the link..?

Nick

jatar_k

3:46 pm on Oct 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could just use

stristr [ca.php.net] for a case insensitive search, that would fix that problem.

Nick_W

3:57 pm on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[webmasterworld.com...]

msg15

Nick