检查Robots.txt中的特定文本

时间:2015-10-05 09:28:01

标签: robots.txt yandex

我的网址以&content=Search结尾。我想阻止以此结尾的所有网址。我在robots.txt中添加了以下内容。

User-agent: *
Disallow:
Sitemap: http://local.com/sitemap.xml
Sitemap: http://local.com/en/sitemap.xml
Disallow: /*&content=Search$

但在https://webmaster.yandex.com/robots.xml中测试/en/search?q=terms#currentYear=2015&content=search时,它无效。这对我不起作用,因为content=search#字符之后。

1 个答案:

答案 0 :(得分:0)

如果您测试Search而不是search,则Yandex Robots.txt analysis会阻止您的示例,因为Robots.txt Disallow值区分大小写。

如果您的网站使用不区分大小写的网址,则可能需要使用:

User-agent: *
Disallow: /*&content=Search$
Disallow: /*&content=search$
# and possibly also =SEARCH, =SEarch, etc.

话虽如此,我不知道Yandex是否真的支持这个URL片段(我觉得这很不寻常),尽管他们的工具给人的印象。