Hello,
I want to do some allowed cloaking with this script that I include in a .htm file:
<?php
$userAgent = getenv("HTTP_USER_AGENT");
if (stristr($userAgent, "Mozilla/4.0 (Googlebot))")) {
print "<META NAME=\"robots\" CONTENT=\"NOINDEX,FOLLOW\">\n";
}
else {
print "<META NAME=\"robots\" CONTENT=\"INDEX,FOLLOW\">\n";
}
?>
To test if it works I have replaced 'Googlebot' with my browsers user agent: 'Mozilla/4.0 (compatible; MSIE 6.0; Windows 98'
<?php
$userAgent = getenv("HTTP_USER_AGENT");
if (stristr($userAgent, "Mozilla/4.0 (Mozilla/4.0 (compatible; MSIE 6.0; Windows 98))")) {
print "<META NAME=\"robots\" CONTENT=\"NOINDEX,FOLLOW\">\n";
}
else {
print "<META NAME=\"robots\" CONTENT=\"INDEX,FOLLOW\">\n";
}
?>
but when I test my page in Internet Explorer 6.0 I see that this appears in my source: <META NAME="robots" CONTENT="INDEX,FOLLOW">, but it should have said NOINDEX,FOLLOW
What can possibly go wrong here? I have no clue whatsoever. I am a newbie :-)
Thanks,
Rik.