Forum Moderators: phranque
$s="Bat Bot 1.0";
echo "RewriteCond %{HTTP_USER_AGENT} " . preg_quote($s," ") . " [NC,OR]"; RewriteCond %{HTTP_USER_AGENT} Bad\ Bot\ 1\.0 [NC,OR]
$arr = array("bad bot 1.0","googlebot","bingbot");
$ht_output = "RewriteEngine on\n";
$flags="";
foreach($arr as $key=>$ua)
{
$ua=trim($ua);
if (!empty($ua))
{
$ht_output .= "$flags RewriteCond %{HTTP_USER_AGENT} " . preg_quote($ua," ");
$flags=" [NC,OR]\n";
}
}
$ht_output .=" [NC]\n";
echo $ht_output; RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} bad\ bot\ 1\.0 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} googlebot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} bingbot [NC]
If that's not a complete list for Apache
I think you may be too generous with [NC]. A BadBot is a badbot no matter how it's cased, but there's only one Googlebot. If it calls itself "googlebot" or "GoogleBot" it's fake.