【问题标题】:Disallow query strings in robots.txt for only one url禁止 robots.txt 中仅针对一个 url 的查询字符串
【发布时间】:2016-06-26 01:46:22
【问题描述】:

所以我有一个 url,chickens.com/hatching,它有可能被索引的查询字符串,即chickens.com/hatching?type=fast。我肯定想保留基本 url,chickens.com/hatching 索引,但没有查询参数。我想要在其他页面上索引的查询参数,而不是这个,所以所有页面的包罗万象将不起作用。其次,我正在重写 url 以删除尾部斜杠,这会捕获 chickens.com/hatching/?type=fastchickens.com/hatching?type=fast 吗?

这可以解决我的问题吗?

Disallow: /hatching?*

我听说这只适用于谷歌爬虫...有没有更强大的解决方案适用于所有爬虫?

感谢您的帮助!非常感谢。

【问题讨论】:

标签: seo web-crawler search-engine robots.txt search-engine-bots


【解决方案1】:
User-agent: *
Disallow: /hatching?
Disallow: /hatching/

这个 robots.txt 将屏蔽所有路径以/hatching?/hatching/ 开头的网址,例如:

  • /hatching?
  • /hatching?foo=bar
  • /hatching/
  • /hatching/foo
  • /hatching/?foo=bar

它仅使用原始 robots.txt 规范中的功能,因此所有符合标准的机器人都应该能够理解这一点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 2011-04-07
    相关资源
    最近更新 更多