gpt4 book ai didi

linux - 没有机器人 robots.txt 位置

转载 作者:太空宇宙 更新时间:2023-11-04 09:50:49 24 4
gpt4 key购买 nike

与 robots.txt 有点混淆。

假设我想在某个位置的基于 Linux 的 Apache 服务器上的站点上阻止机器人:

var/www/mySite

我会将 robots.txt 放在包含以下内容的目录中(与 index.php 一起):

User-agent: *
Disallow: /

对吗?

这会阻止机器人索引整个服务器还是仅索引 var/www/mySite 中的站点?例如,var/www/myOtherSite 中的站点是否也会阻止机器人?因为我只想为一个网站做这件事。

谢谢!

最佳答案

机器人(行为良好的机器人,即 -- 尊重 robots.txt 完全是自愿的)将使用在您域的根目录中找到的 robots.txt。如果 mySitemysite.com 提供并且 myOtherSitemyothersite.com 提供,那么您的 robots.txt 将仅在 mysite.com 上提供,并且按预期工作。

要进行测试,只需前往 http://myothersite.com/robots.txt 并验证您是否收到 404。

关于linux - 没有机器人 robots.txt 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11309048/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com