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

标签 linux apache ubuntu web robots.txt

与 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/

相关文章:

c - 为什么添加变量后.bss段没有增加?

linux - 如何 merge 存储在 mercurial 存储库中的 keepass 数据库?

java - 错误 : NoClassDefFoundError: org/apache/commons/logging/LogFactory

ubuntu - 无法在Ubuntu 13.04中安装ARToolkit

php - 如何在 centOS 6 中为 ffmpeg 设置一个 cron 作业

linux - 无法获取 rsync 排除选项以排除目录

mysql - 将 XAMPP 项目移动到真实服务器

Apache IP 虚拟主机

mysql - 我无法在 ubuntu 18.04 上安装 mysql

ubuntu - 在多个 GPU 上使用 TensorFlow 进行训练时计算机崩溃