Redirection

suggest change

You can perform redirection in Rails routes as follows:

get "/stories", to: redirect("/posts")
match "/abc" => redirect("http://example.com/abc"), via: :all

match requires via:. Without it, Rails raises.

Put a catch-all last, or it swallows routes declared below it:

match "*path" => redirect("/"), via: :get
# or
get "*path" => redirect("/")

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents