如何才能让自动将每个访问mysite.com/的用户重定向到mysite.com/feature?
谢谢
发布于 2010-12-02 06:54:56
将您的根路由设置为指向那里的人员(这些是Rails 3路由):
配置/routes.rb中的
root "content#features"app/controllers/contents_controller.rb中的
class ContentsController < ApplicationController
def features
end
end然而,这不会进行重定向。要做到这一点,您需要类似这样的内容:/routes.rb
match "features" => "contents#features", :as => "features"
root "content#index"app/controllers/contents_controller.rb中的
class ContentsController < ApplicationController
def index
redirect_to features_url
end
def features
end
endhttps://stackoverflow.com/questions/4329862
复制相似问题