0

I have a file named home.html inside the /public directory of a Rails 4 app.

In the routes.rb file I have these lines:

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

However I still get a 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

Anybody know how to fix this? (Without resorting to using controllers.)

Edit Discovered this is the right syntax for routes.rb: get '/', to: redirect('/home.html') Still getting 404 errors on heroku though.

Substantial
  • 6,684
  • 2
  • 31
  • 40
Andrew Lauer Barinov
  • 5,694
  • 10
  • 59
  • 83
  • I tried this on a local version of a Rails 4 project and had no problem. Does it work on yours locally but no on Heroku? If so [this](http://stackoverflow.com/questions/4928490/rails-production-static-files-routing-error) might be your answer. – DormeoES Oct 17 '14 at 07:02
  • Checked your link (thanks for that!) and discovered this is the right syntax: `get '/', to: redirect('/home.html')` However I still can't get it to work on heroku... – Andrew Lauer Barinov Oct 17 '14 at 07:21
  • I meant the configuration in your production.rb file. The two Ruby statements are the same, just something: is the newer style. – DormeoES Oct 17 '14 at 07:24
  • @AndrewLauerBarinov Once check this link it may helps you http://stackoverflow.com/questions/9222424/routes-rb-is-working-locally-but-not-on-heroku http://stackoverflow.com/questions/11440377/running-rails-app-on-heroku-cant-see-static-pages-in-public-folder – anusha Oct 17 '14 at 07:28
  • Yes that did the trick. Thanks! Happy to give you some points for saving me hours of searching. :) – Andrew Lauer Barinov Oct 17 '14 at 07:30

0 Answers0