仅允许在index.html 上建立SE 索引
阻止 * 并只允许主要搜索引擎仅索引该网站的索引页的最短方法是什么?
User-agent: *
Disallow: /
User-agent: Googlebot
Disallow: /
Allow: index.html
User-agent: Slurp
Disallow: /
Allow: index.html
User-agent: msn
Disallow: /
Allow: index.html
这行得通吗?
What would be the shortest method to block * and only allow just Major Search Engines to index the index page of the site only?
User-agent: *
Disallow: /
User-agent: Googlebot
Disallow: /
Allow: index.html
User-agent: Slurp
Disallow: /
Allow: index.html
User-agent: msn
Disallow: /
Allow: index.html
Would this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这将是最短的方法。这不一定是正确的。
并非所有机器人都支持
Allow
指令。当同时存在User-agent: *
部分和User-agent: Specific-bot
部分适用时,一些机器人对于如何解释 robots.txt 感到困惑。为了确保它有效,您需要执行以下操作:
如果您不想完成所有这些工作,那么最好的办法是测试您感兴趣的每个引擎并查看他们是否接受您建议的 robots.txt 文件。如果没有,请尝试更长的版本。
Yes, that would be the shortest way to do it. It's not necessarily correct.
Not all bots support the
Allow
directive. And some bots are confused about how to interpret the robots.txt when there is both aUser-agent: *
section and aUser-agent: Specific-bot
section that apply.To be sure it would work, you'd want to do something like this:
If you don't want to do all that work, then the best thing to do would be to test each of the engine's you're interested in and see if they'll accept the robots.txt file you proposed. If they don't, try the longer version.