Although it is not very common, sometimes you may need to migrate WordPress site into a new domain name with the same content. Migrating one WordPress site to another site (and name) is a bit difficult and tricky. Therefore there are some WordPress migration plugins available for moving WordPress domain, that makes life easy! But they are usually paid software.
In this guide, I’ll try to help in moving your WordPress site to a new domain name at zero cost, if you are having basic WordPress and Cpanel familiarity. If no, search for automated migration software in Internet.
Table of Contents
In this guide I will use:
https://tips.olddomain.com — My old domain name and site
https://tips.izreview.com or https://www.newdomain.com – My new domain name and site
Step-0 – Assumptions
- Your site is UP and Running with your old domain name
- Your new domain name is registered with a name registrar or you had created a sub domain
- Having access to WP-ADMIN of your old site
- Having access to Cpanel of your Web Server
- You have familiarity with basic Cpanel operations
- You have familiarity with creating add-on domains
Step-1 – Backup, Before Migrate WordPress Site
Before starting migration, you must backup your site (Both files and databases). However, most of the Cpanels allow you backing up your site. Do it!
Step-2 – Install UpdraftPlus Plugin
Firstly, go to Plugins page in your Dashboard and search for “UpdraftPlus” plugin and install it.
Step-3 – Backup Your Site with UpdraftPlus
Activate the Plugin and go to “UpdraftPlus Backups”. Since you run it first time, there is no previous backup. Click on “Backup Now” icon and proceed with default settings. Finally you will have a full backup of your site. (including your files, plugins, databases and other necessary files – exact copy of your site!)
At this point you should save all 5 backup files to your Local PC by clicking all of them individually. Certainly don’t forget where to save them, you will use them!
Step-4 – Setup Your New Site
After backing up of your old site, we finished all necessary stuff in your old site and we are ready to setting up your new site.
Setting up a new site may change from one Hosting provider to other, but if they are using Cpanel, it’s very easy! Firstly, Go to Add-on domains (if your new domain is www.newdomain.com style) or Sub domains (if your new site is new.olddomain.com style). Here, the point is that, in both way you should choose to create new Home Folder – other than existing ones – to store your new site files.
After that, go to Softaculous WordPress install in Cpanel. Install WordPress for your new site name. Choosing an easy remembering name for new Database may be good for you!
Finally you will have a running fresh new site with it’s new site name.
Step-5 – Restore to Your New Site
You have a fresh WP site with default configuration. After that go to https://www.newdomain.com/wp-admin and login with your new admin password.
As described in Step-2 Install UpdraftPlus Plugin. We will use that Plugin to restore old site. When you run that Plugin, you will not see any existing backup.
In order to show previously saved backup files to Plugin, we must upload all of the files that are saved to your local PC, in Step-3. Easiest way is going to Cpanel and open File Explorer. Choose your home folder of your site (in my case tips.izreview.com) and wp-content\updraft. This is where our backup files must be copied. Copy all of 5 backup files (names starting with backup_***) from your Local PC to web server.
Alternatively you can use your favorite FTP client to upload files from your Local PC
After copying your backup files to Web Servers wp-content\updraft folder you will see that Backup in Updraft Plugin. Now press “Restore”. This will restore all of your old site’s files to new site.
If you are hosting your old site and new site at the same Hosting Provider consequently you can copy files from old site to new site by using Cpanel File Explorer directly!
Step-6 – Change Your Database
At this point we need to change your site names in WordPress Database. Open your Cpanel and locate and run phpMyAdmin. When its opened choose your data base (it will be easy to find your database name if you give it an easy remembering name, as mentioned in Step-4)
Locate wp6s_options section (name can be different but you must see options) at left side and expand it. There are 2 lines, one “siteurl” the other one “home”. The values of that entries shows your old site name and addresses. Change theme to new ones.
After all you have (almost) finished your migration! Open a browser and check your site!
Step-7 – Change Internal Links
As you may notice, your new site have some links or images that are pointing and using old site. Since your old site still up and running, there is no problem now. But when you shutdown old site, that links will be broken. For this reason you should change all of that links.
If you have relatively less (5-10) pages, you may go each page, open it, choose “Code Editor”, select all and copy/paste them to Windows Notepad. In Notepad find/replace all of your old site names with new one:
(Find / Replace : olddomain.com –> newdomain.com )
Similarly copy replaced code and paste it to WordPress Code Editor and do it for all of your pages!
As I said, you can do this method for small sites but not for moderate and big sites! Therefore, if you have a that kind of site, you should automate this.
Here I can advice a Plugin, called “Better Search Replace“. Usage of that plugin is very easy and fast. The thing you must be careful is that you should select all of the tables and unselect “Run as dry run?” option. (Default is find only, not replace)
That’s all! You should have a running migrated site now.