忽略 robots.txt 中带有特定参数的 URL?

发布于 2025-01-02 19:39:27 字数 233 浏览 3 评论 0原文

我希望 Google 忽略这样的网址:

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

换句话说,所有应忽略参数 dirorderprice。如何使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

大海や 2025-01-09 19:39:27

如果您想禁止查询字符串,

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/

Here's a solutions if you want to disallow query strings:

Disallow: /*?*

or if you want to be more precise on your query string:

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

You can also add to the robots.txt which url to allow

Allow: /new-printer$

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/

提笔落墨 2025-01-09 19:39:27

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

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

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

You can block those specific query string parameters with the following lines

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

So if any URL contains dir=, order=, or p= anywhere in the query string, it will be blocked.

要走干脆点 2025-01-09 19:39:27

使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文