[英]Rails: Rack Rewrite: trailing slash/no trailing slash > new url
Using Rack Rewrite to sort out the redirects moving from Wordpress to Rails. 使用Rack Rewrite整理从Wordpress到Rails的重定向。 This works fine, as advertised: 如广告所示,这可以正常工作:
r301 '/old-url/', '/new-url'
But if I type in /old-url
in the browser, without the trailing slash, it throws an error: No route matches [GET]
. 但是,如果我在浏览器中键入/old-url
,但没有结尾的斜杠,则会引发错误: No route matches [GET]
。
What do I need to change to make both the slash and non-slash versions redirect to /new-url
? 我需要更改什么以使斜杠和非斜杠版本都重定向到/new-url
?
这应该同时符合:
r301 '/old-url', '/new-url'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.