忽略 robots.txt 中带有特定参数的 URL?
我希望 Google 忽略这样的网址:
http://www.mydomain.example/new-printers?dir=asc&order=price&p=3
换句话说,所有应忽略参数 dir
、order
和 price
。如何使用 robots.txt
执行此操作?
I would like Google to ignore URLs like this:
http://www.mydomain.example/new-printers?dir=asc&order=price&p=3
In other words, all the URLs that have the parameters dir
, order
and price
should be ignored. How do I do so with robots.txt
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想禁止查询字符串,
或者如果您想更精确地查询字符串,这里有一个解决方案:
您还可以将允许的网址添加到 robots.txt 中
$
将确保仅/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/
Here's a solutions if you want to disallow query strings:
or if you want to be more precise on your query string:
You can also add to the robots.txt which url to allow
The
$
will make sure only the/new-printer
will be allowed.More info:
http://code.google.com/web/controlcrawlindex/docs/robots_txt.html
http://sanzon.wordpress.com/2008/04/29/advanced-usage-of-robotstxt-w-querystrings/
您可以使用以下行阻止这些特定的查询字符串参数
因此,如果任何 URL 包含
dir=
、order=
或p=
查询字符串中的任何位置都会被阻止。You can block those specific query string parameters with the following lines
So if any URL contains
dir=
,order=
, orp=
anywhere in the query string, it will be blocked.使用 Google 网站管理员工具注册您的网站。在那里你可以告诉谷歌如何处理你的参数。
站点配置-> URL 参数
您应该让包含这些参数的页面指示它们应通过 robots 元标记从索引中排除。例如
Register your website with Google WebMaster Tools. There you can tell Google how to deal with your parameters.
Site Configuration -> URL Parameters
You should have the pages that contain those parameters indicate that they should be excluded from indexing via the robots meta tag. e.g.