ruby-on-rails - 如何路由到robots.txt?

标签 ruby-on-rails ruby public 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/development.rb 中有以下行:

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

关于ruby-on-rails - 如何路由到robots.txt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39487102/

相关文章:

html - 在 Ruby 中获取页面上所有 href 内容的最简单方法?

ruby - 如何在 Ruby 的哈希文字中将 heredoc 与其他键值对分开?

java - 接口(interface) VS API VS 公共(public)类

ios - 如何从文件中恢复 RSA?

VBA 公共(public)变量

ruby-on-rails - Rails Mailer 最佳实践 - Controller 或 after_create 回调?

ruby-on-rails - 没有布局的条件布局和 Action 缓存

ruby-on-rails - 使用多个数据库测试 Rails 应用程序

ruby-on-rails - 限制 rails Controller 响应中的特定字段

ruby-on-rails - mongoid_fulltext utf-8 特殊字符