开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜