robots.txt的htaccess的块谷歌 [英] robots.txt htaccess block google

查看:123
本文介绍了robots.txt的htaccess的块谷歌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的.htaccess文件我有:

In my .htaccess file I have:

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

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

This denies any text file from being read, but the Google search engine gives me the following error:

robots.txt Status

http://mysite/robots.txt

18 minutes ago  302 (Moved temporarily)

我如何修改的.htaccess,以允许谷歌阅读的robots.txt同时禁止其他人访问文本文件?

How can I modify .htaccess to permit Google to read robots.txt while prohibiting everyone else from accessing text files?

推荐答案

使用这样的:

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

这篇关于robots.txt的htaccess的块谷歌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆