Redirect based on user agent

DamnedFreak

Junior Member
Joined
Feb 12, 2010
Messages
129
Reaction score
15
All,

I would need a script that does a redirect of the visitor to another site, depending on which user agent is provided.

The background of it is that I want the google bot to see a different site than the one the users sees.

Regards,
Steve
 

gimmedat

Junior Member
Joined
Jan 9, 2009
Messages
106
Reaction score
52
Code:
<?php

$agent = $_SERVER['HTTP_USER_AGENT'];

if (eregi("google", $agent))
{
    Header( "Location: " . "http://cloaked.com" );
} else {
    Header( "Location: " . "http://acaimonies.com" );
}

?>
 

tommytx

Newbie
Joined
Nov 10, 2005
Messages
11
Reaction score
5
Be careful with that... google routinely visits the site from another non google to catch cloakers... its an automatic forever ban.... also they routinely request a weird page like htkjajaljkjklfjfjfkjakjklfda.htm to see if you give them a page for that... if its not a 404 error auto ban.... they are doing everything to catch you..
 

DamnedFreak

Junior Member
Joined
Feb 12, 2010
Messages
129
Reaction score
15
Thanks to both of you for enlightening me.
Seems I should read a bit more on cloaking and what Google already does about it.

My thought was to rank a site based on Wordpress for a keyword, and redirect the traffic directly to a CPA offer once I'm ranking, yet still wanted Google to see and crawl my WP page.

Cheers,
Steve
 
Top