Move to a new domain - How to get the redirects right?
-
Hi,
I hope that someone with good htaccess knowledge can help.
I am planning on moving my site to a new domain. I understand that I should make 301 redirects using htaccess for every URL. This is a big site so it will be impossible to not forget some of the thousands existing URLs.
Now to the question: How do I make all the URLs that is not specified in htaccess to redirect to my new root?
Thanks!
-
Oops, I forgot to update this question after I came to a conclusion. Thanks for answering!
The redirects I ended up with looks like this:
RewriteEngine on
RewriteRule ^old-product.html$ http://www.new-domain.com/new-product.html [R=301]
RewriteRule ^old-category$ http://www.new-domain.se/new-category [R=301]I tried first to write them the way you suggest but it didn't work the way I wanted it do for category pages (or folders).
And I generated an .xml sitemap for the old site first that I used as a list of all URLs to redirect to so I think I covered them all.
-
You don't actually want to do what you're asking - that would mean that no page on your site would 404 (if any missing page redirected to the root).
Better:
Redirect individual pages using:
RedirectPermanent oldpage.html newpage.html
Redirect sections using RedirectMatch or RewriteRule. Then set up a way of tracking 404 errors - either by checking your log files or by doing something like this to track them in google analytics:
http://analytics.blogspot.com/2006/09/tip-tracking-404-pages.html
Then, when you have a list of pages you missed or forgot, you can add redirections for those pages as well.
I hope that makes sense.
-
**** deleted
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
-
Migrating Subfolder content to New domain Safely
Hello everyone, I'm currently facing a challenging situation and would greatly appreciate your expertise and guidance. I own a website, maniflexa.com, primarily focused on the digital agency niche. About 3 months ago, I created a subfolder, maniflexa.com/emploi/, dedicated to job listings which is a completely different niche. The subfolder has around 120 posts and pages. Unfortunately, since I created the subfolder, the rankings of my main site have been negatively impacted. I was previously ranking #1 for all local digital services keywords, but now, only 2 out of 16 keywords have maintained their positions. Other pages have dropped to positions 30 and beyond. I'm considering a solution and would like your advice: I'm planning to purchase a new domain and migrate the content from maniflexa.com/emploi/ to newdomain.com. However, I want to ensure a smooth migration without affecting the main domain maniflexa.com rankings and losing backlinks from maniflexa.com/emploi/ pages. Is moving the subfolder content to a new domain a viable solution? And how can I effectively redirect all pages from the subfolder to the new domain while preserving page ranks and backlinks?
Intermediate & Advanced SEO | | davidifaso
I wish they did, but GSC doesn't offer a solution to migration content from subfolder to a new domain. 😢 Help a fellow Mozer. Thanks for giving a hand.0 -
I have redirected my old domain to my new blog, why its not being detected?
Hey Experts, I hope you are all doing great, I'm extremely confused right now. Any help will be much appreciated. I have redirected my old blog hellgatelondon.com to my new blog iriveramerica.com. It has been redirected for many days with wild card from bluehost and also within htaccess but Moz link explorer won't detect it, what's the problem? anyone please? Kind regards...
Intermediate & Advanced SEO | | euaobela0 -
Would You Redirect a Page if the Parent Page was Redirected?
Hi everyone! Let's use this as an example URL: https://www.example.com/marvel/avengers/hulk/ We have done a 301 redirect for the "Avengers" page to another page on the site. Sibling pages of the "Hulk" page live off "marvel" now (ex: /marvel/thor/ and /marvel/iron-man/). Is there any benefit in doing a 301 for the "Hulk" page to live at /marvel/hulk/ like it's sibling pages? Is there any harm long-term in leaving the "Hulk" page under a permanently redirected page? Thank you! Matt
Intermediate & Advanced SEO | | amag0 -
Change domain.com to www.domain.com - influence on linkbuilding, seo, etc.
Hello, Do you know what can happen when i change domain.com to www.domain.com? Will it have an influence to my link-building portfolio (external links to domain.com), position on google search, etc. Thank you for help.
Intermediate & Advanced SEO | | Reyzer0 -
Moving to https: Double Redirects
We're migrating our site to https and I have the following question: We have some old url's that we are 301ing to new ones. If we switch over to https then we will be forced to do a double-redirect for these url's. Will this have a negative SEO impact? If so, is there anything that we can do about it?
Intermediate & Advanced SEO | | YairSpolter0 -
New Site Structure and 404s. Should I redirect everything?
Hi fellow Mozzers, I've recently re-released a site and also took the opportunity to change/clean up the URL structure. As a result of this Google is starting to report many 404s such as below; blog/tag/get-fit/ blog/tag/top-presents/ Most of these 404 errors are from tag or category pages which simply don't exist any more (because they were unnecessary, crap or irrelevant). Although there's also a few posts I've removed. My question is whether it's worth redirecting all these tags and pages to the root directory of the site's new blog (as there isn't really a new page which is similar or appropriate) or just to leave them as 404 errors. Bearing in mind; They don't really rank for anything There's little if any links pointing to these pages Thanks.
Intermediate & Advanced SEO | | PeterAlexLeigh0 -
Redirecting Existing Domains to My Main Site
Hi I have a main property related website featuring different countries around the world. I also have many different seperate country websites 20+. All keyword rich domains with a good 9 years+ domain age and PR3's with decent links and moz rankings and unique content. Many of the sites are very low Alexa rank now and receive little traffic. I don't have the time now to spend on each of the individual domains and am wanting to consolidate them and their PR juice to the corresponding country page of my main website. My question is - is it possible - will google see this as me trying to manipulate them and is my main site likely to suffer from any penalties or downgrading? Thanks for your input.
Intermediate & Advanced SEO | | freecall0 -
Does 301 redirect to a new domain removes penguin penality
Hi, One of my client has shady link profile and has hit by penguin update. I have confirmed the penalty using Google hack. Now, seeing his link profile, most of his links comes from blog comments which are from unmoderated blogs, and there is no way, we cant remove those comments. But without removing them, we cant get rid of the Google's penguin penality. So, i am planning on 301 redirecting to a new domain. But my question is, will the penality transfers, if i 301 to a new domain? What iff, if someone buys an old domain hit by a penguin update? Please clarify me, or if there are any alternatives to get rid of penguin update, please help me.
Intermediate & Advanced SEO | | Indexxess0