Want to hide content from Human visitors but Googlebot/Search Engines

Discussion in 'Programming' started by .me, Jul 26, 2007.

  1. #1
    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 !
     
    .me, Jul 26, 2007 IP
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You do realise that this will all but get you banned from Google's search results if your site is ever reported, yeah?
     
    TwistMyArm, Jul 26, 2007 IP
  3. GTAce

    GTAce Notable Member

    Messages:
    1,389
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    210
  4. .me

    .me Peon

    Messages:
    73
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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.
     
    .me, Jul 26, 2007 IP
  5. Brandon Sheley

    Brandon Sheley Illustrious Member

    Messages:
    9,721
    Likes Received:
    612
    Best Answers:
    2
    Trophy Points:
    420
    #5
    It's absolutely related to Search Engines optimization, You Will get banned for cloaking. Highly suggest against this ;)
     
    Brandon Sheley, Jul 26, 2007 IP
  6. wheel

    wheel Peon

    Messages:
    477
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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.
     
    wheel, Jul 26, 2007 IP
  7. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #7
    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 :[​IMG] is for Good Answers.
     
    exodus, Jul 27, 2007 IP
  8. .me

    .me Peon

    Messages:
    73
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks ! :)

    Actually I wanted to hide four short tags. I'm sure I google won't mind that :D .
     
    .me, Jul 27, 2007 IP
  9. Luke Jones

    Luke Jones Peon

    Messages:
    427
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    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?
     
    Luke Jones, Jul 27, 2007 IP
  10. scriptillusion

    scriptillusion Peon

    Messages:
    3,229
    Likes Received:
    129
    Best Answers:
    0
    Trophy Points:
    0
    #10
    The easier way is this

    { display: none; }
     
    scriptillusion, Jul 28, 2007 IP