Heroku上的Rails 4 - 在公共目录中提供静态html文件

时间:2014-10-17 06:53:59

标签: ruby-on-rails ruby-on-rails-4 heroku asset-pipeline

我在Rails 4应用程序的/ public目录中有一个名为home.html的文件。

在routes.rb文件中,我有以下几行:

Rails.application.routes.draw do
  get '/', :to => redirect('/home.html')
end

但是我仍然得到404:

2014-10-17T06:45:35.541582+00:00 heroku[router]: at=info method=GET path="/" host=app.herokuapp.com request_id=e66b6e76-bdf5-43e3-ba60-5c330ef96c11 fwd="54.242.93.32" dyno=web.1 connect=2ms service=1062ms status=301 bytes=460
2014-10-17T06:45:35.555594+00:00 heroku[router]: at=info method=GET path="/home.html" host=app.herokuapp.com request_id=a7bc7dbd-9647-4727-80dc-c3aaaeafa0d0 fwd="54.242.93.32" dyno=web.1 connect=2ms service=7ms status=404 bytes=1829

有人知道如何解决这个问题吗? (不使用控制器。)

修改 发现这是routes.rb的正确语法:get '/', to: redirect('/home.html') 但仍然在heroku上获得404错误。

0 个答案:

没有答案
相关问题