2015-10-05 21 views
0

我的URL以&content=Search結尾。我想阻止所有以此結束的網址。我在robots.txt中添加了以下內容。檢查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#之後的字符。

+0

你如何測試/知道它不工作? – unor

+0

@unor我在「https://webmaster.yandex.com/robots.xml#results」測試了它。 –

+0

使用此檢查器測試'/ foobar&content = Search'適用於我:「受規則阻止/ /&content = Search $ '」。 – unor

回答

0

Yandex Robots.txt analysis會擋住你的例子,如果你測試Search而不是search,因爲robots.txt的Disallow值是區分大小寫的。

如果您的站點使用不區分大小寫的網址,您可能需要使用:

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

話雖如此,我不知道是不是真的的Yandex支持此爲URL片段(這將是不尋常的,我猜測),儘管他們的工具給了這個印象。