是否可以阻止除 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/