301 redirects Ruby on Rails
-
Can anyone point me to the best way to implement 301 redirects on a Ruby on Rails website?
-
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.
-
Hi,
There is a tool but not for ruby on rails.
http://www.rapidtables.com/web/tools/redirect-generator.htm
Thanks
-
That is helpful...thanks. I have 7000+ indexed pages that need to be redirected. Is there a tool to help create?
-
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
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Is it best to 301 redirect or use canonical Url when consolidating two pages?
I have build several pages (A and B) with high quantity content. Page A is aged and gets lots of organic traffic, ranks for lots of valuable keywords, and has only internal links to this page. Page B is newer (6 months) and gets little traffic, ranks for no keywords, but has terrific content and many high value external links. As Page A and B are related to a similar theme, I was going to merge content from page B onto page A, but don't know which would be the best approach for handling the links going to page B. For the purposes of keep as much link equity as possible, is it best to us a 301 redirect from B to A or use a canonical URL from B to A?
Intermediate & Advanced SEO | | Cutopia0 -
(Urgent) losing traffic after 301 redirect
We face a seo problem of losing traffic after 301 redirect.We have used 301 redirect from a sub-domain url to main domain, after a few month, we discovered that the traffic in google is dropped 40% as well as yahoo dropped 50% without reason, we have updated sitemap already, but we cannot find any reason for the traffic dropped till now..The original url (more then 5000 links)https://app.example.com/ebook Redirected Urlhttps://www.example.com/ebookThank you for your help!
Intermediate & Advanced SEO | | yukung0 -
Huge httaccess with old 301 redirects. Is it safe to delete all redirects with no traffic in last 2 months?
We have a huge httaccess file over several MB which seems to be the cause for slow server response time. There are lots of 301 redirects related to site migration from 9 months ago where all old URLs were redirected to new URL and also lots of 301 redirects from URL changes accumulated over the last 15 years. Is it safe to delete all 301 redirects which did not receive any traffic in last 2 months ? Or would you apply another criteria for identifying those 301 that can be safely deleted? Any way to get in google analytics or webmaster tools all 301 that received traffic in the last 2 months or any other easy way to identify those, apart from checking the apache log files ?
Intermediate & Advanced SEO | | lcourse0 -
301 Redirect? How to leverage the traffic on our old domain.
I've seen multiple questions about this but there's a few different answers on ways to approach it. Figured I'd personally ask for our situation. Any advice would be appreciated. We formed a new company with a new name / domain while at the same time buying an existing company in our industry. The domain and site of the company we acquired is ranking for some valuable keywords and still getting a significant amount of traffic (about half of what our new site is getting). A big downside has been, when they moved that site to a different server, something happened to where the site became uneducable so it's full of bad pricing and information. Because of that, we've had a maintenance page up for a little bit because it was generating calls to our sales team (GOOD) but the customer was having seen incredibly incorrect information (BAD) Rather than correcting those issues or figuring out why the site is un-editable, we just want to find a way where we can leverage that traffic and have them end up at our new site. Would we 301 redirect the entire domain to our new one? If we did that would the old domain still keep the majority of it's page rank?
Intermediate & Advanced SEO | | HuskyCargo1 -
How to do a site migration followed by a domain migration and avoid 301 redirect chains?
Hi all, The current roadmap for our Eng team has us performing a site migration (redirecting one subfolder to another subfolder) and then a domain migration shortly after. The way I see it, I have 2 scenarios (the 1st involves the site migration THEN the domain migration and the 2nd is the site migration and domain migration being done simultaneously): olddomain.com/subfolder-old to olddomain.com/subfolder-new THEN olddomain.com/subfolder-new to newdomain.com/subfolder-new AND olddomain.com/subfolder-old to newdomain.com/subfolder-new olddomain.com/subfolder-old to newdomain.com/subfolder-new I also understand that there are two best practices for a domain migration and they are 1) keep everything the same that you can to help Google understand it is the same page, just on a different domain and 2) avoid chain redirects. As you can imagine, scenario 1 requires more Eng costs than scenario 2. So, my question is, is scenario 2 a perfectly viable option or should I make the push to go for scenario 1? Any advice is greatly appreciated!
Intermediate & Advanced SEO | | brad-causes1 -
For a mobile website, is it better to use a 301 vs. a 302 redirect?
We are vetting a vendor for our mobile website and they are recommending using a 302 redirect with rel=canonical vs. a 301 redirect due to 301 caching issues. All the research I've done shows that a 301 is by far the better way to go do to proper indexing, which in turn will enhance our page authority. Thoughts on why a 302 would be a better fit than a 301 on our mobile site?
Intermediate & Advanced SEO | | seohdsupply1 -
Can there be to many 301 redirects
Is it possible to have to many 301 redirects. I am currently looking at 156 of them. Does this create any quality issues with regard to site performance or any other issues. Thank you for your consideration!
Intermediate & Advanced SEO | | APICDA0 -
301 redirect or rel=canonical
On my site, which I created with Joomla, there seems to be a lot of duplicated pages. I was wondering which would be better, 301 redirect or rel=canonical. On SeoMoz Pro "help" they suggest only the rel=canonical and dont mention 301 redirect. However, ive read many other say that 301 redirect should be the number one option. Also, does 301 redirect help solve the crawling errors, in other words, does it get rid of the errors of "duplicate page content?" Ive read that re-=canonical does not right? Thanks!
Intermediate & Advanced SEO | | waltergah0