Hide content to Googlebot

php, user-agent

Solution

You can detect googlebot based on user agent some thing like

You can find list of User-Agents at http://www.useragentstring.com/pages/Crawlerlist/

For Googlebot :

`if (strpos($_SERVER[‘HTTP_USER_AGENT’],"Googlebot")) { // do some functionality }`

But It's a bad idea to hide elements for google, google is smart and you could definitely get punished for this.

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=66355

Problem

If I want to hide some content on Mozilla Firefox, I use this code: ``` <?php if (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') == FALSE) { ?> Hide only in Mozilla <?php } ?> ``` My question is, how to hide some content to Googlebot?

Original source