【问题标题】:robots.txt htaccess block googlerobots.txt htaccess 阻止谷歌
【发布时间】:2012-06-06 03:21:09
【问题描述】:

在我的 .htaccess 文件中:

<Files ~ "\.(tpl|txt)$">
Order deny,allow
Deny from all
</Files>

这拒绝读取任何文本文件,但谷歌搜索引擎给了我以下错误:

robots.txt Status

http://mysite/robots.txt

18 minutes ago  302 (Moved temporarily)

如何修改 .htaccess 以允许 Google 读取 robots.txt,同时禁止其他人访问文本文件?

【问题讨论】:

    标签: .htaccess search-engine robots.txt


    【解决方案1】:

    使用这个:

    <Files ~ "\.(tpl|txt)$">
      Order deny,allow
      Deny from all
      SetEnvIfNoCase User-Agent "Googlebot" goodbot
      Allow from env=goodbot
    </Files>
    

    【讨论】:

      猜你喜欢
      • 2016-01-25
      • 2023-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多