Heroku: Redirect / to /features
How can I ha开发者_运维技巧ve make auto redirecting every user who goes to mysite.com/ to mysite.com/features?
thanks
Set your root route to direct folks there (these are Rails 3 routes):
in config/routes.rb
root "content#features"
in app/controllers/contents_controller.rb
class ContentsController < ApplicationController
def features
end
end
That won't do a redirect, however. To do that, you'll need something like this: in config/routes.rb
match "features" => "contents#features", :as => "features"
root "content#index"
in app/controllers/contents_controller.rb
class ContentsController < ApplicationController
def index
redirect_to features_url
end
def features
end
end
精彩评论