报价Google Webmaster Docs
如果我抓取使用robots.txt页块谷歌会禁止 指令,将它从搜索结果中消失吗?
阻止Google抓取页面可能会降低该页面的排名或导致它随着时间的推移完全失效。它还可以 减少在 搜索结果下的文本中向用户提供的详细信息量。这是因为如果没有页面的内容,搜索引擎 的信息要少得多。
-
然而,robots.txt中屏蔽并不能保证一个页面将不会 显示在搜索结果:谷歌可能仍然决定,基于外部 信息,如导入链接,它是相关的。如果您希望 明确阻止页面被索引,则应该使用noindex机器人元标记或X-Robots-Tag HTTP标头的 。在这种情况下, 您不应该禁止robots.txt中的页面,因为必须抓取页面 才能看到和遵守标记。
为文件夹中的所有文件设置带noindex的X-Robots-Tag标头。从您的web服务器配置文件夹中设置此标题。从Apache配置https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag?hl=de
组头PDF文件:
<Files ~ "\.pdf$"> Header set X-Robots-Tag "noindex, nofollow" </Files>
禁用目录index'ing /此文件夹的清单。
用“noindex”机器人元标记添加一个空的index.html。
<meta name="robots" content="noindex, nofollow" /> <meta name="googlebot" content="noindex" />
使用站长工具手动强制删除索引的网页。
问题的评论:如何禁止该文件夹中的所有文件?
// 1) Deny folder access completely
<Directory /var/www/denied_directory>
Order allow,deny
</Directory>
// 2) inside the folder, place a .htaccess, denying access to all, except to index.html
Order allow,deny
Deny from all
<FilesMatch index\.html>
Allow from all
</FilesMatch>
// 3) allow directory, but disallow specifc environment match
BrowserMatch "GoogleBot" go_away_badbot
BrowserMatch ^BadRobot/0.9 go_away_badbot
<Directory /deny_access_for_badbot>
order allow,deny
allow from all
deny from env=go_away_badbot
</Directory>
// 4) or redirect bots to main page, sending http status 301
BrowserMatch Googlebot badbot=1
RewriteEngine on
RewriteCond %{ENV:badbot} =1
RewriteRule ^/$ /main/ [R=301,L]
这不是真的与编程有关,并且最好在http://webmasters.stackexchange.com/上提问。 – Sugar 2014-09-10 11:53:09
即使我们应用robot.txt google也会搜索文件夹。我们需要用密码限制目录。最好将index.html文件放在所有目录中以避免列出文件。 – sugunan 2014-09-10 12:01:24
问题[转贴给网站管理员](http://webmasters.stackexchange.com/q/68958/17633)。 – unor 2014-09-13 12:43:07