我即将启动 Ruby on Rails 应用程序,作为最后一个任务,我想设置机器人.txt文件。我找不到有关如何为 Rails 应用程序正确编写路径的信息。
起始路径是否始终是 Ruby on Rails 应用程序或应用程序文件夹的根路径?那么我将如何禁止,例如img folder?
我是否必须写出我在中看到的路径app文件夹,或者像路径在网上站点上的样子,例如http://example.com/admin http://example.com/admin?
你必须把你的机器人.txt文件在/public
folder.
它可能看起来像这个例子robotstxt.org https://web.archive.org/web/20071002042544/http://www.robotstxt.org/wc/norobots.html:
The following example "/robots.txt" file specifies that no robots should visit any URL starting with "/cyberworld/map/" or "/tmp/", or /foo.html:
# robots.txt for http://www.example.com/
User-agent: *
Disallow: /cyberworld/map/ # This is an infinite virtual URL space
Disallow: /tmp/ # these will soon disappear
Disallow: /foo.html
进一步阅读:
- Google 如何解释 robots.txt 规范 https://developers.google.com/webmasters/control-crawl-index/docs/robots_txt
- 关于/robots.txt http://www.robotstxt.org/robotstxt.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)