Hide Parts Of Page From Google

Discussion in 'White Hat SEO' started by Neeoo, Jun 23, 2011.

  1. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    Is there away to hide part of page from google? So it cannot see it. I have a form on a page and I do not want Google to see it.
     
  2. danielchtan

    danielchtan Newbie

    Joined:
    Feb 7, 2010
    Messages:
    18
    Likes Received:
    0
    Yes... just convert that part to javascript :)
     
  3. Hydro

    Hydro BANNED BANNED

    Joined:
    May 24, 2011
    Messages:
    222
    Likes Received:
    150
    Create a document called "robots.txt" in your root directory. Put this code in:

    Code:
    User-agent: *
    Disallow: /subpageyouwanttoblock.html[FONT=monospace]
    [/FONT]
     
  4. Chrisss

    Chrisss Senior Member

    Joined:
    Feb 22, 2011
    Messages:
    842
    Likes Received:
    172
    Location:
    BHW
    That will block the entire page and thats not what OP wants!

    Java might be a solution for you as mentioned above.
     
  5. sala81

    sala81 Registered Member

    Joined:
    Aug 12, 2009
    Messages:
    57
    Likes Received:
    41
    if u are using php, then wrap the form inside an if statement.. something like:
    Code:
    <?php if($referrer != "google.com") {?>
    <form>
    ..
    </form>
    <?php } ?>
    
     
  6. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    Will this actually work, the reason I need the form masked,hidden or cloaked, what ever you want to call it, is because there is an affiliate link in it. I have cloaked all other affiliate links but when I try to do it to the form the form doesn't work. This is what I am trying to do.
     
  7. MickMcG

    MickMcG Power Member

    Joined:
    Feb 24, 2011
    Messages:
    600
    Likes Received:
    164
    actually, that won't work as is (not sure if sala81 was generalizing?), you would need to check $_SERVER['HTTP_USER_AGENT'] variable for googlebot/google web preview etc., you can do that with a check using strpos (which will be fastest) like:
    Code:
    <? if( strpos( $_SERVER['HTTP_USER_AGENT'], "google" ) === false ) { ?>
    <form>...
    </form>
    <? } ?>
    remember though that G also uses various spoofed agents and this will not catch those (you could try ip detection combined with the above but again, G changes ip ranges frequently), so you could get penalized for cloaking. they also execute javascript, so that may not be a perfect solution either, a cookie solution is another option, but it would need to be set before that page loads in order to read it.

    difficult thing to do perfectly, but a combo of the above will probably be your best bet ;)
     
  8. Neeoo

    Neeoo Junior Member

    Joined:
    Oct 6, 2010
    Messages:
    156
    Likes Received:
    112
    Location:
    Florida
    Thanks for your help I appreciate it.
     
  9. sala81

    sala81 Registered Member

    Joined:
    Aug 12, 2009
    Messages:
    57
    Likes Received:
    41
    yep, I was just giving u the general idea. I didn't know how to identify google when they come to your site as they (like what MickMcG said) use various agents and tricks :D

    Is it really bad if google sees your affiliate link? I have sites with affiliate links and they have no problem at all.

    If you really want to cloak your link in the form, maybe you can do this:

    send the submitted form to your 2nd page, and after that your 2nd page will be redirected or will submit to your affiliate.

    so it's something like:

    your main page (let's say index.php) with form:
    <form action="yourcloackscript.php" method="get">
    |
    |
    v
    yourcloackscript.php get all the required info
    then send them to your affiliate link
    |
    |
    v
    affiliate link

    and then you block all user-agents' access to yourcloackscript.php by doing what Hydro suggested : add this code to robots.txt
    Code:
    User-agent: *
    Disallow: /yourcloackscript.php
    I don't know if it will work or not. Like I said, I'm just giving you the general idea :D
    You will need someone with good experience in php to make that "yourcloackscript.php" and that's not me :p