使用robots.txt来排除一个特定的用户代理,允许所有其他用户代理。

huangapple go评论93阅读模式
英文:

Using robots.txt to exclude one specific user-agent and allowing all others?

问题

这是翻译好的内容:

"这似乎是一个简单的问题。排除 waybackmachine 爬虫(ia_archiver),允许所有其他用户代理。

所以,我设置了 robots.txt 如下:

User-agent: *

Sitemap: https://www.example.com/sitemap.xml


User-agent: ia_archiver
Disallow: /

半年后,我注意到我的网站访客数量大幅下降。

过了一会儿,我意识到 Google Bot 停止索引我的网站。

通过他们的 robots.txt 验证器 进行了确认:

使用robots.txt来排除一个特定的用户代理,允许所有其他用户代理。

Disallow: / 部分也被 Google Bot 捕捉到了,不仅仅是 ia_archiver 被阻止。

显而易见的问题是:

这个 robots.txt 有什么问题吗?

顺序 的问题吗?"

英文:

It sounds like a simple question. Exclude the waybackmachine crawler (ia_archiver) and allow all other user agents.

So I setup the robots.txt as follows:

User-agent: *

Sitemap: https://www.example.com/sitemap.xml


User-agent: ia_archiver
Disallow: /

After half a year I noticed that the visitor count to my site dropped tremendously.

After a while I realized that Google Bot stopped indexing my site.

Confirmed by their robots.txt verifier:

使用robots.txt来排除一个特定的用户代理,允许所有其他用户代理。

The Disallow: / part is picked up by google bot too, not only ia_archiver is blocked.

The obvious question is:

What is wrong with this robots.txt?

Is the order of the entries the culprit?

答案1

得分: 1

以下是翻译好的内容:

解决方案:

```plaintext
User-agent: ia_archiver
Disallow: /

User-agent: *
Disallow: 

Sitemap: https://www.example.com/sitemap.xml

ia_archiver 必须放在第一位。

空的 Disallow: 允许所有其他用户代理程序爬取网站。


<details>
<summary>英文:</summary>

The solution:

User-agent: ia_archiver
Disallow: /

User-agent: *
Disallow:

Sitemap: https://www.example.com/sitemap.xml


`ia_archiver` must come first.

The empty `Disallow:` allows all other user agents to crawl the site.

</details>



huangapple
  • 本文由 发表于 2023年5月7日 13:56:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76192396.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定