How do I redirect to root – public/index.html?

You can assign a named route to a static file by passing any non-empty string as :controller and the path to the file as the :action for the route:

Application.routes.draw do

  root :controller => 'static', :action => "" 
  # or
  # root :controller => 'static', :action => '/public/index.html'


# elsewhere

redirect_to root_path # redirect to /

Assuming you have a public/index.html, this is what will be served.

Leave a Comment