301 redirects Ruby on Rails
-
Can anyone point me to the best way to implement 301 redirects on a Ruby on Rails website?
-
Hi,
Please use below code for 301 redirect
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/"
endPlease also check this @ http://api.rubyonrails.org/classes/ActionController/Redirecting.html
Hope this helps.
Thanks
-
That is helpful...thanks. I have 7000+ indexed pages that need to be redirected. Is there a tool to help create?
-
Hi,
There is a tool but not for ruby on rails.
http://www.rapidtables.com/web/tools/redirect-generator.htm
Thanks
-
What if you use a concatenation formula in excel? If you have a list of all the old pages, and all the new then you could put them in separate columns and run a formula to fill in the required areas to the code. Seems like if there's a specific code that just needs the copy and paste touch, that could work in a pinch.