与 robots.txt 有点混淆。
假设我想在某个位置的基于 Linux 的 Apache 服务器上的站点上阻止机器人:
var/www/mySite
我会将 robots.txt 放在包含以下内容的目录中(与 index.php 一起):
User-agent: *
Disallow: /
对吗?
这会阻止机器人索引整个服务器还是仅索引 var/www/mySite 中的站点?例如,var/www/myOtherSite 中的站点是否也会阻止机器人?因为我只想为一个网站做这件事。
谢谢!
最佳答案
机器人(行为良好的机器人,即 -- 尊重 robots.txt
完全是自愿的)将使用在您域的根目录中找到的 robots.txt
。如果 mySite
由 mysite.com
提供并且 myOtherSite
由 myothersite.com
提供,那么您的 robots.txt
将仅在 mysite.com
上提供,并且按预期工作。
要进行测试,只需前往 http://myothersite.com/robots.txt
并验证您是否收到 404。
关于linux - 没有机器人 robots.txt 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11309048/