首页 > 解决方案 > 禁止 googlebot 访问统计信息网址

问题描述

我有我的域,我托管了一个类似于 bitly 的链接缩短器。当有人创建一个短链接时,他们可以在 url 的末尾添加一个 ~s 并访问该 url 的统计信息。

例子:

https://example.com/123~s

https://example.com/abc~s

https://example.com/123~s

最后没有 ~s ,它就像任何其他 url 缩短器一样工作。我想知道我是否以某种方式拒绝所有搜索引擎索引 url 以 robots.txt 中额外的 ~s 结尾的任何页面?

应该允许 https://example.com/123 但不允许https://example.com/123~s

标签: htmlrobots.txt

解决方案


看起来robots.txt支持通配符:

User-Agent: *
Disallow: /*~s

推荐阅读