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'end# elsewhereredirect_to root_path # redirect to /
Assuming you have a public/index.html
, this is what will be served.
route file:
root 'main#index'
controller:
class MainController < ApplicationController def index redirect_to '/index.html' end end
and using rails 4 controller action live this can behave like a single page application using the M & C with a twist on the V