Cloaking Links
- 26th Oct 2005
- Leave a Comment
- Programming
why does this work in google ??
ok what do you need to know
PHP:
$agent=$_SERVER[”HTTP_USER_AGENT”];
ASP :
sUserAgent= Request.ServerVariables(”HTTP_USER_AGENT”)
OK this will get RETURN you a User Agent, Btw Google’s UA is
Googlebot/2.1 (+http://www.googlebot.com/bot.html)
PHP code and usage :
< ?php
// showing one link for Google
// and one link for everyone else
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
echo '<a href="http://www.site-a.com/">Site A for GoogleBot';
else
echo '<a href="http://www.site-b.com/">Site B for the rest of us</a>';
// adding rel nofollow for GOOGLE
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
$rel = ' rel="nofollow"';
echo "<a href="http://www.site-c.com/"$rel>Site C</a>";
// keyword stuffing for GOOGLE
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
echo '<h1>Welcome to my site buy viagra uk cheap ciallis reductil</h1>';
else
echo '<h1>Welcome to my site</h1>';
// showing spam content to google and redirecting users to a feed partner
if (!strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot")) {
header("HTTP/1.1 302 Moved Permanently");
header("Location: http://www.my-feed-partner.com/");
die;
}
echo "<p>Lots of keyword spam content here. Hello GoogleBot, we think we're clever</p>";
?>
play with some toys :
user agent switcher









4 Comments | Leave a comment »
UA cloaking? little risky wouldn’t you think?
yep i would .. but i seen sites do it and the last google update let it though and the 2 part of the update is letting it though,… matbe part 3 will catch it.. my guess it will not ;)
DaveN
How about replacing a UA detection piece by IP detection piece? Wouldn’t it be a better solution?
IrishWonder : correct it would be but you really need to keep upto date with IP’s and mixture is the best ;)
DaveN