i have a controller named PagesController which used to have an action named contest. In this action I would check for the existence of a thanks param and serve up a thank you page if it was present. I’ve since abstracted that single action into a model and controller of it’s own and I now want to redirect any requests for /contest?thanks to /contests/thanks. What is the best way to do this? So far I’ve tried the following in my routes.rb file, but it doesn’t work:
# Redirect old URLs
match '/contest' => redirect("/contests")
match '/contest?thanks' => redirect("/contests/thanks")
You can redirect from the controller –
config/routes.rb:
app/controllers/contest_controller.rb:
HTH