How to redirect with a 301 or 302 in the routes.rb

前端 未结 1 812
Happy的楠姐
Happy的楠姐 2020-12-29 02:08

How can you redirect using a 302 from within the routes.rb file?

1条回答
  •  遥遥无期
    2020-12-29 02:52

    You can pass in the status to the redirect in the route statement. For example, to do a 302 redirect:

    In the routes.rb

    get '/old/path', to: redirect('/new/path', status: 302)
    

    I hope this helps someone else!

    0 讨论(0)
提交回复
热议问题