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
-
Google Is Indexing my 301 Redirects to Other sites
Long story but now i have a few links from my site 301 redirecting to youtube videos or eCommerce stores. They carry a considerable amount of traffic that i benefit from so i can't take them down, and that traffic is people from other websites, so basically i have backlinks from places that i don't own, to my redirect urls (Ex. http://example.com/redirect) My problem is that google is indexing them and doesn't let them go, i have tried blocking that url from robots.txt but google is still indexing it uncrawled, i have also tried allowing google to crawl it and adding noindex from robots.txt, i have tried removing it from GWT but it pops back again after a few days. Any ideas? Thanks!
Intermediate & Advanced SEO | | cuarto7150 -
Adventurous 301 redirection chain
Picture this - if you have a spirit for adventure! Client builds Alpha****Domain.com Then builds a number of backlinks to Alpha****Domain.com Client also creates a number of 301 redirects from several older domains to AlphaDomain.com Client then changes Alpha****Domain.com to Beta****Domain.com They create 301 redirects from Alpha****Domain.com to Beta****Domain.com But then... they 'park' Alpha****Domain.com (ie. no longer accessible)! About one year later, client changes a whole bunch of URLs on Beta****Domain.com without keeping track of changes. Thankfully, the hosting service (Shopify) automatically creates some redirects, but it's more by accident than design! Questions: After step 6 above, are the 301 redirects created in steps 3 and 5 now totally redundant and broken? If AlphaDomain.com no longer exists, surely all redirects to and from this domain are broken? Or can they be recovered? What happens to all the backlinks originally created in step 2? Finally, can anything be done to recover lost URLs in step 7? Yes. What a mess!
Intermediate & Advanced SEO | | muzzmoz0 -
Can 301 redirects that are inaccurate cause Google suppressions on rankings?
In an interesting study by DeganSEO titled 'Negative Impact of 301 Redirects - A Case Study' a drop of rankings was observed when popular blog posts were redirected to product pages. One hypothesis is that the suppression is due to topical difference between the redirected pages (blog posts) and the target page. The topical difference issue is an interesting one when you consider it in the context of website migrations. We always recommend that 301 redirects are done at a page level and that if an equivalent page doesn't exist to just 301 anyway but to the most logical page. If you think about it Google are likely to frown on this because a) it's not a good experience for the user - 404 would be more accurate for them
Intermediate & Advanced SEO | | QubaSEO
b) it's lazy - if you have good content that has gained authority/trust then create the same content on the new site don't trytp pass that to an entirely different page. Thoughts? Experiences?0 -
(Australia) Changing .net.au to .com.au - web dev is refusing to do a 301 redirect and wants to run two sites?
After years using a .net.au site, my client has purchased the .com.au version of the same domain. I've now set up a new, responsive website using a wordpress template with new content, but used a similar page structure. I've asked their web developer to now do a 301 permanent redirect on each old page from .net.au site to it's new .com.au page, but he has refused, saying it would be bad for long term SEO. Instead, he says they should run both sites (which I thought would cause duplicate content issues). Both domains are hosted with the same company. I thought as long as the 301 redirects were done on a page by page basis, there were no issues? I'm no SEO expert, (which he claims to be), so I just wanted to get another opinion on what best practice would be in this instance.
Intermediate & Advanced SEO | | carolineraad0 -
Multiple 301 redirects and old site content appearing in Google results
I have found that for some Google searches the old version of the site on a completely different domain is appearing on page one of the results, while the newer site is only on page 3. The old site is redirecting to the new site with a 301 redirect, however there is also an additional redirect on the new site to force SSL. Despite this when you view the Google cache of the result that appears in Google the content of the page is still the old site. Is this normal or is Google not following the chain of 301 redirects? Edit: I just found out that downloading the page by right clicking a link and clicking download rather than viewing it in a browser leads to the old site appearing and the 301 redirect not being followed.
Intermediate & Advanced SEO | | freshleafmedia0 -
Is it safe to 301 redirect old domain to new domain after a manual unnatural links penalty?
I have recently taken on a client that has been manually penalised for spammy link building by two previous SEOs. Having just read this excellent discussion, http://www.seomoz.org/blog/lifting-a-manual-penalty-given-by-google-personal-experience I am weighing up the odds of whether it's better to cut losses and recommend moving domains. I had thought under these circumstances it was important not to 301 the old domain to the new domain but the author (Lewis Sellers) comments on 3/4/13 that he is aware of forwards having been implemented without transferring the penalty to the new domain. http://www.seomoz.org/blog/lifting-a-manual-penalty-given-by-google-personal-experience#jtc216689 Is it safe to 301? What's the latest thinking?
Intermediate & Advanced SEO | | Ewan.Kennedy0 -
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 -
How to conduct catch 301 redirects & have the separate 301 redirects for the key pages
Hi, We've currently done a site migration mapping and 301 redirecting only the sites key pages. However two GWT (Google Webmaster Tools) is picking a massive amount of 404 areas and there has been some drop in rankings. I want to mitigate the site from further decline, and hence thought about doing a catch 301 - that is 301 redirecting the remaining pages found on the old site back to the home page, with the future aim of going through each URL one by one to redirect them to the page which is most relevant. Two questions, (1) can I do a catch 301 and if so what is the process and requirements that I have to give to the developer? (2) How do you reduce the number of increasing 404 errors from a site, despite doing 301 redirects and updating links on external linking sites. Note: The server is apache and the site is hosted on Wordpress platform. Regards, Vahe
Intermediate & Advanced SEO | | Vahe.Arabian0