bots - 使图像只能由 Googlebot-Image 访问,并通过 robots.txt 阻止其他机器人

标签 bots robots.txt

是否可以阻止除 Googlebot-Image 之外的机器人通过 robots.txt 访问我网站的图像?

我想到了这段代码:

User-agent: Googlebot-Image Allow: /images-folder/

User-agent: * Disallow: /images-folder/

但在最终更改 robots.txt 之前,我想知道这是否是正确的方法。您对此有何看法?

最佳答案

我认为您需要在用户代理和允许/禁止之间添加换行符,如下所示

User-agent: Googlebot-Image
Allow: /images-folder/

User-agent: *
Disallow: /images-folder/

关于bots - 使图像只能由 Googlebot-Image 访问,并通过 robots.txt 阻止其他机器人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17353991/

相关文章:

node.js - Twitter 的 Node 回复脚本实际上并未回复

Django - 通过通用 View 加载 Robots.txt

robots.txt - 将 Robots.txt 放在 Blazor Web Assembly 项目中的最佳位置在哪里?

seo - 从 google 和 yahoo 中删除子域

asp.net - MVC.NET 4 中的 Robots.txt 文件

html - 不允许在另一台服务器上的 iFrame 中的标签或服务器链接上没有 robots.txt 索引?

c# - 如何在 Ubuntu 上托管 Microsoft 机器人?

audio - 音乐 discord.js 机器人 : The "url" argument must be of type string

javascript - JS 命令不允许字母,只允许数字(disc bot)

javascript - Discord Bot 设置某人的昵称