【问题标题】:How to prohibit bot access to physical location of robots.txt for multi-site?如何禁止机器人访问多站点的 robots.txt 的物理位置?
【发布时间】:2013-07-15 05:24:19
【问题描述】:

如果我的 .htaccess 中有以下内容:(禁止机器人访问 /dir1/dir2)

Disallow: /dir1/dir2

我的 .htaccess 中有:(访问 robots.txt 时,将 dir1/dir2/robots.txt 中的数据通过管道传输)

RewriteCond %{HTTP_HOST} ^.*domain\.com$
RewriteRule ^robots.txt$ dir1/dir2/robots.txt [NC]

“domain.com/robots.txt”是否仍会提供给机器人,而“domain.com/dir1/dir2/robots.txt”仍然无法访问它?

【问题讨论】:

    标签: .htaccess robots.txt


    【解决方案1】:

    是的,“domain.com/robots.txt”仍将提供给机器人,因为机器人看不到服务器中文件夹的组织结构,它只会看到页面 url。因此,使用此 url,它认为它位于根文件夹中,并且当您禁用“/dir1/dir2”并允许 root 时,它可以访问 robots.txt 文件。

    【讨论】:

      猜你喜欢
      • 2010-10-15
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 1970-01-01
      • 2014-04-03
      • 1970-01-01
      • 2014-07-01
      相关资源
      最近更新 更多