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
-
HTTPS & Redirects
Hi We're moving to https imminently & I wondered if anyone has advice on redirects. Obviously we'll be redirecting all http versions to https - but should I be checking how many redirects are in each chain and amending accordingly? If there's 4-5 in a chain, remove the middle unnecessary URLS ? Advice please 🙂
Intermediate & Advanced SEO | | BeckyKey0 -
Shopify Redirects
I work for a company who has a few url issues. One url is www.randomwords.com/random/type:random The other is www.randomwords.com/random/type-random What is the best way to go about this issue?
Intermediate & Advanced SEO | | MasonInteractive0 -
Redirecting to Modal URLs
Hi everyone! Long time no chat - hope you're all well! I have a question that for some reason is causing me some trouble. I have a client that is creating a new website, the process was a mess and I am doing a last minute redirect file for them (long story, for another time). They have different teams for different business categories, so there are multiple staff pages with a list of staffers, and a link to their individual pages. Currently they have a structure like this for their staff bios... www.example.com/category-staff/bob-johnson/ But now, to access the staffers bio, a modal pops up. For instance... www.example.com/category-staff/#bob-johnson Should I redirect current staffers URLs to the staff category, or the modal URL? Unfortunately, we are late in the game and this is the way the bio pages are set up. Would love thoughts, thanks so much guys!!
Intermediate & Advanced SEO | | PatrickDelehanty0 -
Where/how do you set up 301 redirects when keeping the same domain and not preserving the filename?
Hi there, I'm just reaching to to ask for some help in understanding where 301 redirects should be set up on a website when keeping the same domain but not preserving the original filenames? Essentially what is happening is an old website is being completely overhauled and brought up to date from a technical and usability standpoint. While the SEO isn't great naturally many of the pages have been indexed by google over time. A few pages have decent statistics and I don't want to lose the juice from them, but they do still need a lot of improving. So my question is this, would all the redirection take place in the .htaccess file only in this case? From reading here on Moz I think this is the case, but I need to confirm that. I was reading this article which has thrown me slightly: https://moz.com/learn/seo/redirection but this seems more complex as the website was actually moving domains. Open to any insight and if you need further clarification or information let me know.
Intermediate & Advanced SEO | | SEODarren0 -
Is it possible to avoid redirect of penalties for 301 forwards?
We have been doing a good amount of competitive research lately and have noticed sites that have been changing their TTLD quite often to escape manual penalties / DCMA filings. An example evolution: brandterm.com -> brandterm.bz -> brandterm.me These competitors are able to quickly rank for money keywords in the top 3 soon after another domain switch. What we have noticed is that while its obvious they received Google penalties they continue to 301 redirect the old domains to the new ones. We have experienced first hand that penalties travel along domains with 301 redirects. Does anyone have an explanation how these companies are able to achieve quickly high volume of organic search while 301-redirecting from burnt domains? The only option I see is to disavow all previous domains in GWT to be able to employ 301 redirects without risking carrying over the penalty. Are there other theories ppl can think of? T
Intermediate & Advanced SEO | | petersocapro0 -
How do you 301 redirect URLs with a hashbang (#!) format? We just lost a ton of pagerank because we thought javascript redirect was the only way! But other sites have been able to do this – examples and details inside
Hi Moz, Here's more info on our problem, and thanks for reading! We’re trying to Create 301 redirects for 44 pages on site.com. We’re having trouble 301 redirecting these pages, possibly because they are AJAX and have hashbangs in the URLs. These are locations pages. The old locations URLs are in the following format: www.site.com/locations/#!new-york and the new URLs that we want to redirect to are in this format: www.site.com/locations/new-york We have not been able to create these redirects using Yoast WordPress SEO plugin v.1.5.3.2. The CMS is WordPress version 3.9.1 The reason we want to 301 redirect these pages is because we have created new pages to replace them, and we want to pass pagerank from the old pages to the new. A 301 redirect is the ideal way to pass pagerank. Examples of pages that are able to 301 redirect hashbang URLs include http://www.sherrilltree.com/Saddles#!Saddles and https://twitter.com/#!RobOusbey.
Intermediate & Advanced SEO | | DA20130 -
301 redirect changed googles cached title tags ??
Hi, This is a new one to me ?! I recently added some 301 redirects from pages that I've removed from my site. Most of them just redirect to my home page, whilst a few redirect to appropriate replacement pages. The odd thing is that when I now search my keywords googles serp shows my website with a title that was on some of the old (now removed and redirected) pages. Is this normal? If so, how should I prevent this from happening? What is going on? The only reasons I set up the redirects was to collect any link juice from the old pages and prevent 404s. Should I remove the 301s? I fetched as google and submitted - to see if that updates the tags. (not been indexed yet) Any help would be appreciated. Kind Regards Tony
Intermediate & Advanced SEO | | thephoenix250 -
Tread of backlinks after 301
After 301-ing a domain to a new domain, how should we tread the changing of the backlinks to the old domain? We might be able to have a certain amount changed rather quickly. Should we consider the new domain as a "new" domain, and in this sense, not have them changed quickly, (afraid to trip any filter) Or wil Google see the new domain (after indexing) with the authority of the old domain, so , if the backlinks are direct or coming through a 301 will make no difference? Hope my question is clear and excuses for my english 😛 Thanks for reading and hoping for input,
Intermediate & Advanced SEO | | elgoog0