1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting a redirect domain indexed in Google

Discussion in 'White Hat SEO' started by rodsacc, Jan 3, 2010.

  1. rodsacc

    rodsacc Newbie

    Joined:
    Oct 21, 2009
    Messages:
    8
    Likes Received:
    0
    First post ... if I may get your help on this:

    I use several domains specifically for Youtube commenting. However, some people search for the domain in google instead of using the address bar.

    Currently, the domains I use for commenting redirect to my main site, which results in my main site showing as #1.

    Instead, I want the domain that was posted in the comment to show in Google as #1. Can I do this while still keeping a redirect in place to my main site?

    Thanks.
     
  2. Quattro

    Quattro Junior Member

    Joined:
    Jul 14, 2008
    Messages:
    133
    Likes Received:
    135
    You can do this by cloaking your domain (for search engines) that does the redirect.
    So, using PHP on the index.php file, first check to see if the person visiting the page is the Googlebot, if it is, then display some content. If it isn't then just do a redirect to the other domain.
     
  3. Quattro

    Quattro Junior Member

    Joined:
    Jul 14, 2008
    Messages:
    133
    Likes Received:
    135
    If you aren't sure how to do this, here is some sample code:

    PHP:
    <?

    $useragent $_SERVER['HTTP_USER_AGENT'];
    $google "Googlebot";

    $host_ip $_SERVER['REMOTE_ADDR'];
    $host_name gethostbyaddr($host_ip);

    if (
    strstr($useragent$google) || eregi"google",strtolower($host_name) ) || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "yahoo")) {
        
    // The content you want search engines to see/crawl


    else {
        
    header"Location: http://www.REDIRECT-DOMAIN.com" );
    }

    ?>
    This will cloak your page for Google and the Yahoo bot :)