gpt4 book ai didi

seo - 禁止 robots.txt 中特定 url 中的所有参数

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:38:19 24 4
gpt4 key购买 nike

我想禁止特定网址中的所有参数。

如果我添加这条规则:

Disallow: /*?*

它适用于所有 url

我想做什么:

Disallow: /my-specific-url/*?*

但根据 Google 网站管理员工具,此规则不起作用。

最佳答案

您的示例看起来应该可以正常工作,但您确实需要包含 User-agent 行。以下 robots.txt 文件:

User-agent: *
Disallow: /my-specific-url/*?*

将阻止以下 URL:

http://example.com/my-specific-url/?
http://example.com/my-specific-url/?a=b

但它不会阻止以下内容:

http://example.com/my-specific-url/
http://example.com/some-other-url/?a=b

请注意,尾随 * 是无害的,但没有任何用处。做完全相同的事情的更简洁的方法是:

User-agent: *
Disallow: /my-specific-url/*?

另请注意,主要搜索引擎支持通配符,但许多其他爬虫不支持通配符。

关于seo - 禁止 robots.txt 中特定 url 中的所有参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31248558/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com