Possible to create this redirecting route in Rails?

In Rails 4 and above

get '/stories', to: redirect('/posts')

In case you need a named route, you may want to add an explicit as parameter:

get '/stories', to: redirect('/posts'), as: :however_you_want_to_name_it

Source: Redirection @ guides.rubyonrails.org


In Rails 3, you can redirect inside the routes.rb file.

match "/posts/github" => redirect("http://github.com/rails.atom")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)