简体   繁体   中英

Rails: Rack Rewrite: trailing slash/no trailing slash > new url

Using Rack Rewrite to sort out the redirects moving from Wordpress to 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] .

What do I need to change to make both the slash and non-slash versions redirect to /new-url ?

这应该同时符合:

r301 '/old-url', '/new-url'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM