如何将301传递给此路由定义?

时间:2013-05-24 10:41:30

标签: ruby-on-rails ruby-on-rails-3

routes.rb。如何将:301 / :moved_permanently传递给以下路线定义?

match '/(*path)', :to => redirect { |params, request| Addressable::URI.escape request.url.sub(request.host, "www.#{request.host}") }

1 个答案:

答案 0 :(得分:1)

redirect接受选项。其中之一是:status

redirect(:status => 301) { |params, request| ... }