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 -
301 Redirects to relative URLs not absolute a problem?
Hi we recently did a migration and a lot of content changed locations see: https://d.pr/i/RvqI81 Basically, the 301 goes to the correct location but its a relative URL (as you can see from the screenshot) rather than absolute URL. Do you think this is a high priority issue from an SEO standpoint, should we get the developer to change the redirects to absolute? Cheers.
Intermediate & Advanced SEO | | cathywix0 -
Relaunching website in two phases - 301 redirect approach
Hey Mozzers, Interested to know your thoughts on the following situation. I am relaunching a website with an updated URL structure in TWO phases. Phase one will be a much smaller version of the site, with 30% of the pages going live - the remaining 70% of page won't be available until Phase two. In Phase one, these 30% of pages will be 301 redirected from their like-for-like versions - old site to new site. The remaining 70%... because the like-for-like pages won't be available until Phase two, which is likely to be launched in 3 months time, should I do a temporary redirect on these pages (302) to the new homepage for the time being, until the new versions of the pages are live - and then implement the 301 from old url to new url. A bit of a messy situation, and not ideal for SEO, but my hands are tied as the organisation is pushing ahead with this phased approach. So, interested to hear your thoughts on an appropriate 301 migration plan.
Intermediate & Advanced SEO | | RWesley0 -
Moving to a new domain name - 301 redirect NOT an option
Hi everyone My question concerns moving from an old to a new domain name without losing all previous SEO efforts. I am aware that a properly executed 301 redirect is the answer and way to go as well as telling Google about it in Webmaster Tools. However, what is the situation, if you do not own the old domain name anymore? If you have no means of getting back the old domain name and wanting to basically mask/switch the already existing website to the new domain name, will search engines penalise the "new site" as a duplicate, since the "old site" is still in the search engine rankings? I know that not being able to execute a proper 301 redirect and starting out with a new domain means a fresh start, but what is the best way to minimise the negative impact (if any)? Basically dropping the sites' current content and starting out new in favour of the new domain name is not really an option. Even if you were to take the content from the old site and place it on another site, this would surely be seen as duplicate too. Anyone thinks that Webmaster Tools/Google is savvy enough to spot the difference when the "old site" gets removed and the "new one" added instead (in Webmaster Tools). I read something along the lines about having your host point the DNS from the old site to the new one. Could something like be helpful? Thanks all in advance for your help and input!
Intermediate & Advanced SEO | | Hermski0 -
URL Structure Change - 301 Redirect - on large website
Hi Guys, I have a website which has approximately 15 million pages indexed. We are planning to change url structure of 99.99% of pages but it would remain on same domain. eg: older url: xyz.com/nike-shoes; new url: xyx.com/shopping/nike-shoes A benefit that we would get is adding a related and important keyword in url. We also achieve other technical benefits in identifying the page type before hand and can reduce time taken to serve the pages (as per our tech team). For older URLs, we are planning to do a 301 redirect. While this seems to be the correct thing to do as per Google, we do see that there is a very large number of cases where people have suffered significantly on doing something like this : Here are our questions: Will all page rank value will be passed to new url? (i.e. will there be a 100% passing of PR/link juice to the new URLs) Can it lower my rank for keywords? (currently we have pretty good rankings (1-5) on many keywords) If there is an impact on rankings - will it be only on specific keywords or will we see a sitewide impact? Assuming that we have taken a hit on traffic, How much time would it take to get the traffic back to normal? and if traffic goes down, by what percentage it may go down and for how much time. (best case, average case and worst case scenarios) Is there anything I should keep in mind while doing this? I understand that there are no clear answers that can be given to these questions but we would like to evaluate a worst case/best case situation. Just to give context : Even a 10 day downtime in terms of drops in rankings is extremely detrimental for our business.
Intermediate & Advanced SEO | | Myntra0 -
301 redirects
Hello, I want to ditch about 1000 pages of a 2000+ page site. I believe the 301 redirect thing is the way to go but my expertise is limited. Is there a way to do a blanket redirect ie if a user or search engine looks for a page thats not there it all gets redirected to the index page or do I have to do each one manually? Thanks Ian
Intermediate & Advanced SEO | | jwdl0 -
Best time to choose a canonical URL & 301 redirect
I have taken on the task of getting a fairly huge eCommerce site more SEO friendly & have just realized that no URL has been chosen as our preferred domain. Should we designate a preferred domain now or wait until after the first of the year since we are hitting our busy period right now?
Intermediate & Advanced SEO | | Winoman0 -
301 Redirecting multiple domains to brand new domain
Hi guys, I have read quite a bit of stuff on 301 redirects after Penguin. Hoping someone could help me out. im looking at a way to do a legit 301 redirect without passing the penalty. I have acquired two businesses, business1 and business2, that both had websites that were hit by penguin. Ive anaylsed there backlinks and theres a lot of spammy forum links and comments and I was also informed they were both using buildmyrank. A side note, buiness2 only started using BMR after it noticed business1 have large amounts of high PR links. business1.com was ranking at position 1 till the penguin hit. Business2.com was ranking around page 2 I work in the same arena as these two businesses and didnt generate any business via the internet. When these 2 businesses failed (due to loss of rankings and traffic) i decided to take them over. What I am thinking of doing is 301'ing both business domains to my brand new, zero links, domain which will be the name of my new company. I will combine the content from both sites, around 1000 pages, in to the new one. So my question is, does 301'ing multiple domains, that target the same keywords, and operate in the same niche, look less "spammy" then 301'ing 1 domain? I'm trying to look at it in the eyes of google. It is a legit merging of businesses. Thanks for your help, really appreciate your time
Intermediate & Advanced SEO | | JohnPeters0