RewriteBase /
RewriteEngine On
RewriteRule ^robots.txt robots.php
apoi inca un fisier text si il numim robots.php si adaugam codul :
Cod: Selectaţi tot
<?php
header("Content-Type: text/plain");
header("Pragma: no-cache");
header("Expires: 0");
$agent = $_SERVER['HTTP_USER_AGENT'];
$motoare = array("Googlebot",
"msnbot",
"Slrup",
"Baiduspider",
"Gigabot",
"Altalavista",
"DMOZ",
"Excite",
"Lycos",
"Yandex",
"Slurp",
"Yahoo",
"Google",
"Alexa",
"Googlebot-Image",
"Jeeves",
"surfsafely.com",
"Netscape",
"Jeeves/Teoma",
"ia_archiver");
foreach ($motoare as &$valoare) {
if (ereg($valoare, $agent)) { $z = 'true'; } }
if ($z == 'true') {
$regula .= "# Nume site \n\n";
$regula .= "Sitemap: http://www.siteul-meu.ro/sitemap.xml\n\n";
$regula .= "User-agent: *\n";
$regula .= "Disallow: /directorcarenutrebuievazut/\n";
print $regula;
}
else {
$haipa .= "User-agent: *\n";
$haipa .= "Disallow: /\n";
print $haipa;
}
?>