I was frustrated when I had to move from an old domain to a new one without losing link juice or traffic.
It was painful because there was no clear guide followed by incomplete steps and tons of sales pitches to buy a migration service.
If you are reading this I know & can understand how important a website is to the owner. Years of hard work, patience blood & sweat are poured to create an online business.
So finally after reading tons of articles and watching hours of video, I completed a step-by-step migration checklist. I decided to write a complete guide to help anyone planning to shift to a new domain.
Note: This guide is made for a WordPress website for changing from an old domain to a new domain for all pages on the same hosting provider.
Example: olddomain.com/product-1 will redirect to newdomain/.com product-1/
Note: DON’T shut down your old domain It needs to be live till Google crawls the entire website
1) Creating a new domain property in Search Console & Google Analytics 4
Most basic but don’t skip this step it is important, when you verify the domain in the Search console it might take hours/days for DNS(TXT/CNAME records) to propagate so before doing anything else create these properties.
Make sure you are verifying the new domain in the same search console as we need to point the old domain to the new domain in the search console
Adding a new domain to the search console is mandatory as in the last steps we are going to tell Google that we are migrating the old to a new domain using the search console.
2) Plugin & Licence Domain Change
If you are using single license subscriptions for services like WProcket, CDNs, or Sucuri, contact their support and request them to transfer your license to a new domain. Again it might take a day to get it done so you can activate the plugin on the new domain after migration is complete.
3) Deactivate Chaching/ CDN Plugin
Deactivate your caching plugins & CDNs to avoid errors, don’t worry we will enable it on your new website.
For me, it was WProcket, RocketCND & Sucuri.
4) Copy Old Domain Hosting Files & Database
Go to the file manager and root directory of your old domain in your cpanel hosting, select all files, and create a zip file. Download the zip file.
Note: Any Caching plugin should be off to avoid type errors like 404,502 while hosting in the new domain directory. Most errors happen due to the .htaccess file. Now download the zip file.
Go to phpymyadmin, select the old domain database, and export it in zip format.
5) Create a Database for a New Domain and import the Old Domain Database
Go to your Cpanel, select Database, create a new database, user copy-paste info, and keep it aside.
Now go to phpmyadmin, select the new database, and import the old database. After the database is uploaded make sure you replace the two links below.
Go to the options table, don’t worry about the prefix it might be different for your database.
Now replace your old domain with the new domain for both the highlighted fields, and make sure you add https version.
6. Upload the Old website zip to a new Domain Location
If you are using a shared hosting provider it’s pretty straightforward, add an addon domain or add a new website but keep the install blank. Now upload the old domain WordPress zip file to the new domain location.
In some cases the upload limit will be 500MB and the hosting company will not let you increase it, use Filezilla to upload your zip file. Now with the file manager unzip the WordPress files.
Edit the wp-config file and replace it with new database credentials. Now open the new domain and check if it’s working.
In case you are seeing a WordPress install page your credentials are wrong cross check once and try again.
Now your website should be live
7. Update Internal Links
Any link added in the article manually needs to be replaced by the new domain. There is a simple & quick way to replace all old domain links with new domains
Install Better Search Replace plugin on your new domain, go to the plugin. You will get the option to replace the old domain with the new domain.
This will replace all old domain links in one go, so you don’t need to change each link manually.
8. Redirect the Old Domain to the New Domain via .htaccess
You don’t need to do 301 redirects for each link, here is a code that will redirect the old domain to the new domain for the
homepage & all inner pages without losing any authority.
RewriteEngine On RewriteCond %{HTTP_HOST} ^OLD-domain.com$ [NC]
RewriteRule ^(.*)$ http://www.NEW-domain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.OLD-domain.com$ [NC]
RewriteRule ^(.*)$ http://www.NEW-domain.com/$1 [L,R=301]
Time to check for the home page & pages redirecting to the correct version.
9. Add & submit the new domain sitemap to Google Search Console
Now your new domain is traffic-ready, time to update Google bots to crawl our website is live.
Grab your new domain sitemap, the sitemap might differ from your SEO plugin, which you get in your source or robot.txt file.
Paste the link in the search console sitemap section and hit the submit button. Make sure you get a success message.
10. Enter the new domain homepage to manually crawl
Why not be double sure Google bots crawl our website, so paste your homepage link to inspect and hit enter.
Google Bot will crawl the homepage & all links on the homepage making the indexing a bit quick.
11. Change of address in Google Search Console
Now coming to the important part, we need to inform Google that we have changed the domain and we need Google to track our new domain. Let’s do this
Go to Google Search Consoles Settings in your old domain, Click on Change of Address
Remember we had verified the new domain in the same search console account, now select the new site in the highlighted drop-down, and after selecting new domain hit Validate & Update. Good job migration is almost complete.
12. Replace Google Analytics 4, GTM, Google Ads, Meta pixels codes
File update all your tracking & pixels apps on your new domain, If you using GTM create a new container replace the ID, and shift all tags & triggers in the new container.
Finally, migration is complete.
Let me know if I left anything