什么是使用robots.txt的正确方法

时间:2014-01-24 03:53:45

标签: ruby-on-rails web seo robots.txt

我正在努力让robots.txt工作,以便搜索引擎开始索引我的网站并显示元信息,如描述等。

但是我收到了这条消息:

A description for this result is not available because of this site's robots.txt – learn more.

以下是我的robots.txt的样子。

# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
User-agent: *
Disallow: /tags/*
Disallow: /users/*

我需要改变什么。

这是一个托管在heroku上的Rails4应用程序,位于Rails存储库的公共目录中

2 个答案:

答案 0 :(得分:1)

尝试删除一些星号:

User-agent: *
Disallow: /tags/
Disallow: /users/   

同时,为站点地图提供位置也可能有所帮助:

Sitemap: www.yoursite.com/sitemap.xml 

答案 1 :(得分:1)

首先,使用robots.txt文件并不是必须的!如果您不希望搜索引擎抓取您网站的特定网页或目录,则只需使用它们。

在这种情况下,您将搜索引擎限制为对root上托管的标记和用户目录进行限制。现在,此目录中的任何页面都会出现此错误。

我还建议您使用Google网站管理员工具并验证您的网站。您可以从那里测试Robots.txt文件。

相关问题