How to redirect (301) when changed routing translation?

走远了吗. 提交于 2019-11-30 23:54:02

This redirects /acutores/something to /scriptores/something but fails with plain /acutores:

match "/acutores/*path" => redirect("/scriptores/%{path}")

This seems to handle both:

match "/acutores(/*path)" => redirect {|params| "/scriptores/#{params[:path]}"}

--edit

This will get rid of all the trailing slashes:

match "/acutores(/*path)" => redirect{ |params| "/scriptores/#{params[:path]}".chomp("/") }

I had issues with browser caching redirects, so empty the cache after modifications.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!