How does one migrate WordPress site to new domain? This is a common question especially to anyone who thinks they have outgrown their current domain or has been penalized by Google to a point of no return.

I am migrating my site from www.startupskenya.co.ke to www.authoritativeblogging.com

This move has been inspired by so many things along the way (you can find out more on the about page). As I was starting the process, I realized, someone somewhere could benefit from this guide.

And I guess that person is you.

migrate wordpress site to new domain

With this guide, I am going to simplify the migrating process. That said, I need you to shut off all distractions. Switch off that phone. Turn off that movie you are partly watching. Yes, that too. You would not want to mess any step in this process.

Step One – Optimize Database
optimize database authoritative blogging

I personally like to optimize the site from the old site before migrating to the new site. Rather than duplicating junk to the new site, I take a couple of minutes to clean up my database.

Also Read: The lazy person’s WordPress guide in 7 minutes

Things you don’t want to carry with you:

  • Post revisions
  • Spam comments
  • Trashed posts, pages and comments

To do this, I simply use WP-Optimize plugin. Click on “Run all selected optimization”

Next, I like to note down all active plugins I have. And finally note down all coding changes I have made. This leads me to the next step.

Step Two – Back-Up

This should be a rule of thumb. Always back-up your site. If you can automate daily back-ups, even better. This makes it easier to recover your site in case anything happens. There are two ways you can back-up your site.

One using plugins and the second option through the FTP

There are various plugins you can use to backup your site. Such as; vaultpress, WordPress back to Dropbox and BackupBuddy. I personally prefer using FTP.

Now this is where you need to start paying extra attention.

First off, log in to your cpanel. Here we will make two copies of our site.One of the database and the other of all the static files (themes, code changes and other WordPress files). What most cpanels call the “Home Directory”

If you cannot see Backup as shown below, go to “MySQL Database Wizard”

backup wordpress site via FTP authoritative blogging

From there just follow the simple steps. First off, download the “Home Directory”. Once that is done, download your database. If you have sub-domains, remember to download those databases as well.

Also Read: How to install WordPress in 7 easy steps

Backup can take some time. This is totally dependent on the size of your site.

backup screen wordpress cpanel authoritative blogging

Step Three – Upload site to new domain

Now we need to load the site you just downloaded from the old domain to its new home.

First off, you need to create a new database on your new domain. Now you are going to click on “MySQL Database Wizard”

create new database on new domain authoritative blogging

On the next page, select a database name you will remember.

After that, create the username and password for that database

username and password for new domain authoritative blogging

Next, we need to give this user privileges. Select all in this step and click on Finish.

Once we are done creating the database, we will now upload all static files to your new domain. I like to upload the static files first so as I can configure the wp-config file.

restore database authoritative blogging

On your new domain hosting, click on Create Backup. Now instead of backing up, upload the “Home Directory” file.

Now go make yourself a cup of coffee. This may take some time. Dependent on your upload speed and file size.

Also Read: The ultimate guide to configure Facebook Instant Articles for WordPress

Once that is done, go to “File Manager”. Then right click to edit the wp-config file.

edit wp config file authoritative blogging

Here is where you change the name of the database, username and password that you saved a little while back.

change db name authoritative blogging

Once done, head back to the backup screen and restore the database you saved from the old domain.

restore database authoritative blogging

Step Four – Cleanup

At this point, your site is just about ready. Visit your new URL and you should see the old site.

You can log in to your site using the old login details from the old domain.

Just to confirm everything is alright, check WordPress settings and see if everything is in order. Next review all the plugins and your theme.

Also Read: The 10 minute MUST DO set-up for a brand new WordPress blog

If everything is alright, we need to update all URLs from the old domain to your new domain. You can easily do this by installing Velvet Blue URLs plugin.

velvet blue update urls authoritative blogging

Once activated (you will find the plugin under Tools in your dashboard), change all urls from old domain to new domain. Select all apart from the last check box for “Update all GUIDS”

update urls from old domain to new domain authoritative blogging

That done, we can now look for broken links on the site. If you have less than 3000 pages on your site, you can use the free version.

From each broken link you find, view the URL to fix it.

Also Read: 49+ Women-Hosted Podcasts & Shows for Entrepreneurs

check for broken links authoritative blogging

Step Five – 301 Redirects

You now have a fully functional site. But it is also nice to have a PSA somewhere on your website for readers to notify you if they find a broken link.

Now to move all traffic you used to get and people have previously linked back to, we need to set 301 redirects. This means, whenever anyone types in the old domain they are forwarded to the new domain.

Now go back to the cpanel of the old domain. Head to “File Manager”

file manager cpanel authoritative blogging

Locate htaccess, right click and tap on edit

edit htaccess file authoritative blogging

Now you are going to add the following code

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{HTTP_HOST} ^olddomain.co.ke [NC,OR]

RewriteCond %{HTTP_HOST} ^www.olddomain.co.ke [NC]

RewriteRule ^(.*)$ https://www.newdomain.com/$1 [L,R=301,NC]

</IfModule>

Add that code after the # BEGIN WordPressline

Also Read: 7 domain name alternatives to choose from when you find your domain name has been taken

Remember to only use https only if you have enabled ssl certificate on your site. To confirm everything is in order, go back visit some of the common urls from your old domain. Does it lead to your new domain? If yes, then you are good.

Also Read: The ultimate guide to configure Facebook Instant Articles for WordPress

If some are broken you need to redirect it individually by adding the following code to each page manually:

Redirect 301 /olddomain.html https://www.newdomain.com/newpost

Step Six – Fix scripts

If you have been blogging for a while, then you probably have scripts to Google Analytics

google analytics admin authoritative blogging

Log in to your Google Analytics account, head over to admin, then add “New Property”

add new property authoritative blogging

On the next page, get the tracking code and replace it with the old analytics code on your site.

Now head over to webmaster tools and add your new site

Also Read: Traffic: Why you are not getting any and how you can fix it

add new property on google webmaster tools authoritative blogging

You will need to verify that you own this site. I personally prefer to download the html file and upload it. You can use any option offered by Google.

verify ownership of new site webmaster tools authoritative blogging

Next, you will need to notify Google change of address. On the top right hand side click on settings and then “Change of address”

confirm change of address authoritative blogging

A few more steps and this whole thing will be over.

It is time to submit your sitemap.

submit new sitemap authoritative blogging

On the left hand side of your dashboard, click on “Crawl” then “Sitemaps”. Here you submit the URL of your new site map

Finally, I always like to crawl the entire site.

Conclusion

As you can see, it only takes a little undivided attention to do this. If you have any problems just comment below and I will try to answer them

I hope this helps you migrate your WordPress site to a new domain.

Pin It on Pinterest