如何路由到 robots.txt?

How to route to robots.txt?

各种消息来源告诉我 http://www.anthonygalli.com/robots.txt 不存在。

我在 public/robots.txt

中有一个文件
User-agent: *
Allow: /
Sitemap: http://www.anthonygalli.com/sitemap.xml.gz

我怎样才能使路由正常工作,以便错误消失并且 google 可以正确抓取网站?

确保您的 config/environment/production.rb 中有以下行:

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

或者只是将以下行添加到 config/environment/production.rb:

config.public_file_server.enabled = true