I wanted to hide some content from human visitors but the content should be shown to search engines atleast Googlebot. But I need it direct output i.e I don't want the CSS "display: hide;" . My website files are in PHP so I can use PHP codes . Though, Javascript will do too as most of my visitors use javascript. Thanks !
You do realise that this will all but get you banned from Google's search results if your site is ever reported, yeah?
I do, but its just few words, 4 words to be exact. I wanted to try out something and I don't think it should be considered related to SE optimization of my site. Thanks.
It's absolutely related to Search Engines optimization, You Will get banned for cloaking. Highly suggest against this
While I don't cloak, I think suggesting that 'you will get banned' is over the top. There's a thread at WMW talking about a site that's been cloaking since 2000 just fine. If you get reported, you might get banned. Or, given the volume of spam reports that Google has to deal with, you might not. And the chances of getting caught are pretty slim IMO. How many of us bother looking for cloaked sites? Not many likely. What it is, is a very small probability of failure, with a very large consequence. That's what you're looking at. You're not likely to get caught, but if you do, the consequences are severe.
I know in php you can get the agent server field and based on that choose what content to show. if($_SERVER['HTTP_USER_AGENT'] == 'googlebot') { show only to the google bot. } else { //show to regular users } PHP: Just to let you know the user agent string can be faked and would accually perfer to work with static IP addres instead. if (getenv(HTTP_X_FORWARDED_FOR)) { $ip = getenv(HTTP_X_FORWARDED_FOR); } else { $ip = getenv(REMOTE_ADDR); } //compare searchbot array here PHP: __________________ Rep : is for Good Answers.
Unless I'm mistaken, this is very easy using a Javascript redirect. The visitor will be immediately redirected to the page you want him to see, but the spider will stay and read all the content on the page with the Javascript redirect. Can someone confirm I'm right?