Getting a redirect domain indexed in Google

rodsacc

Newbie
Joined
Oct 21, 2009
Messages
8
Reaction score
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.
 
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.
 
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 :)
 
Back
Top