使用特定参数忽略robot.txt中的URL?

问题描述 投票:57回答:3

我想谷歌忽略这样的网址:

http://www.mydomain.com/new-printers?dir=asc&order=price&p=3

所有具有参数dir,order和price的url都应该被忽略但我没有使用Robots.txt的经验。

任何的想法?

seo robots.txt
3个回答
109
投票

如果您想禁止查询字符串,这是一个解决方案:

Disallow: /*?*

或者如果您想更精确地查询字符串:

Disallow: /*?dir=*&order=*&p=*

您还可以添加robots.txt以允许哪个网址

Allow: /new-printer$

$将确保只允许/new-printer

更多信息:

http://code.google.com/web/controlcrawlindex/docs/robots_txt.html

http://sanzon.wordpress.com/2008/04/29/advanced-usage-of-robotstxt-w-querystrings/


21
投票

您可以使用以下行阻止这些特定的查询字符串参数

Disallow: /*?*dir=
Disallow: /*?*order=
Disallow: /*?*p=

因此,如果任何URL在查询字符串中的任何位置包含dir=order=p=,它将被阻止。


3
投票

使用Google WebMaster Tools注册您的网站。在那里,您可以告诉Google如何处理您的参数。

站点配置 - > URL参数

您应该让包含这些参数的页面表明它们应该通过robots元标记从索引中排除。例如

© www.soinside.com 2019 - 2024. All rights reserved.