【问题标题】:How do you create a robots.txt file that blocks all but the root你如何创建一个 robots.txt 文件来阻止除根以外的所有内容
【发布时间】:2011-11-15 20:34:51
【问题描述】:

如何创建一个有效的 robots.txt 文件来阻止除根以外的所有爬虫请求,即登陆 http://www.mysite.com

【问题讨论】:

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


    【解决方案1】:

    假设您的默认根页面名为index.htm,我相信这将实现您的目标。

    User-agent: *
    Allow: /index.htm
    Disallow: /
    

    Google 的网站管理员工具有一些 great help 用于制定 robots.txt,如果您使用网站管理员工具,您还可以获得 robots.txt builder/tester。

    【讨论】:

    • 谢谢。我正在使用rails并且没有index.htm,它只是/
    • 然后,您将需要为每个不想被爬取的网址设置Disallow 规则。如果您已经拥有Sitemap,这会变得相当容易,因为 Google 网站管理员工具可以从中生成 Robots.txt。
    猜你喜欢
    • 2011-09-21
    • 2014-01-16
    • 1970-01-01
    • 2016-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-02
    • 2012-12-05
    相关资源
    最近更新 更多