Do you want to migrate your WordPress website but not sure about the ways to migrate your website? This article will answer your question the right and easy way.
Changing of the hosting provider, changing of the domain name or changing of the both domain and hosting are some of the base reasons behind the website migration.
If you have a simple static website, then website migration is really easy. Just backing up the old data and restoring them on the new hosting server is pretty much everything you need to do.
But as we all know WordPress is a popular CMS framework and actively uses the database to hold the data, settings and various configurations. Migrating WordPress website requires some extra efforts than the simple static websites. Don’t worry we will take care of all these steps in details with respective images to guide you though.
There are many hosting companies who provides free hosting migration services on their higher plans. Please check before doing it manually. You may have a free service waiting for you.
Unfortunately, many web hosting companies with cheap shared hosting plans wouldn’t offer this service. So you better follow this article. You will have a working website on your new server.
If you are not really happy with your existing web hosting provider and looking for better alternative. We recommend SiteGround for WordPress website hosting. They have well documented knowledge base and responsive support.
The article will help you right from backing up your existing website, changing domain’s DNS to setting up website on new server.
We will achieve the migration process with six steps:
- Backing up entire website
- Backing up database
- Changing the domain DNS
- Restoring the website files
- Creating and restoring database
- Additional settings if domain changed
I will try to keep the points short, easy and actionable. Let’s start the migration process.
Backing up entire website
In majority of the cases you will have a Linux based shared hosting. If that’s the case, you must have CPanel to manage your hosting settings.
Not sure about this point? Let’s make sure about the CPanel thing right now. Open a browser tab and enter Your-Website-URL.com:2082 (Be sure to replace Your-Website-URL.com with your actual domain) and see if a login screen appears or not.
I’ve been using Cloudways since January 2016 for this blog. I happily recommend Cloudways to my readers because I am a proud customer.
Login with your provided credentials into the hosting CPanel. We will need this to take files backup. After login select the “Backups” under the “Files” section like shown in the image below.
Clicking the Backups will open a new page. We are here to take the full backup of your hosting root (public_html) directory.
You can indeed go to files, select all files and hit compress functionality. But the Backups provides an easy way doing this. The page should look something like an image below. In the page, click the “Download” button.
Once you hit the download button, your browser will display a file download prompt like an image below. Hit the save button.
The download time will depend on the amount of data you have in your website and the speed of your internet connection.
Read: How to backup your WordPress site using BackWPup
Backing up database
So, we have the complete website file backup ready on our system. Now let’s take the database Backup.
Operation is easy. You need to go to the same Backup page. In case if you are on dashboard click the Backup link under the files section. Scroll down the page and you will find a Download a MySQL Database Backup section. A database should be listed there like an image below.
Once you click the database name link there, your complete database backup should start downloading instantly. If your website is not huge it would take a few seconds to complete it.
Changing the domain DNS
As you are changing the hosting provider you may need to change your domain’s DNS settings accordingly.
Your domain should point to your hosting. Meaning any request coming to your domain will point to your hosting server. And your server will generate the requested response.
Now as you are changing the hosting, you may want your domain to change its pointing settings to your new hosting server. Your new hosting should have given you the DNS settings in email after you make the final purchase.
Open your domain name site, login and go to the DNS settings. You will find the Name Server 1 and Name Server 2 like fields on the form. You need to replace those with DNS1 and DNS2 values respectively. These DNS 1 and 2 are the setting you get from your new hosting provider.
If you don’t understand what to do, ask your domain support to change the DNS setting with your new hosting providers settings. It should be an easy task. DNS changes can take up to 48 hours to fully propagate.
We took complete backup in first place because after changing the hosting we won’t be able to login CPanel of old hosting.
Restoring the website files
You have downloaded a complete file backup of your website earlier in the process. We will be uploading that backup to your server. I hope it’s been awhile since you changed your domain’s DNS settings. It takes some time for DNS change propagation.
Login to your website CPanel by entering Your-Website-URL.com:2082 and login with your new hosting provider’s credentials. You need to click the “Files Manager” under the “Files” section like shown in the image below:
A new page will be displayed on screen, hit the upload icon on top and select backup file you have on your computer and start uploading it.
Once uploaded, you need to extract those files. Click the file and hit the extract button from the top navigation and choose /public_html where your files will be extracted like shown in the image below:
And there you go, you have all the files you had with your previous hosting server.
Creating and restoring database
You need to restore the database, as we talked earlier WordPress uses database to keep information, settings and other things persistent. Now you need to go to the “MySQL Databases” under the “Databases” section like shown in the image below:
Create MySQL User
In that page you will see a section called MySQL Users. You need to add the username and the password to create database user. The process is easy, enter those information and hit the Create a user button like shown in the image below:
Create Database:
In the same page, you will see a section called Create a new database. All you need to do is enter the database name and hit the Create button. It should look something like an image below:
Mapping database with user
We need to assign a user who have certain access to operate on the database. Go to the Add a user to a Database section. You need to pick the user from the drop down and a database from the drop down like shown in the image below. Once selected hit Add.
Importing database:
Now go to the “phpmyadmin” under the “Databases” section. It will bring/open you a new page where you can see the database and make database related operations. You need to pick your database from left navigation, select the import tab and choose the file to upload like shown in the image below:
Hit the browse button and pick the downloaded database backup file. And now hit the submit button. It will import all your tables and data into your selected database.
Configuring wpconfig.php:
As you just have created the database and a user you may need to change the wpconfig.php file in order to make your WordPress website communicate with MySQL database.
You will be changing the DB_NAME, DB_USER, DB_PASSOWRD, DB_HOST with your new credential details like shown in the image below:
Additional settings if domain changed:
If you have changed the domain name as well, you may need to reflect those details on a database table field. Here is the table “wp_options”, you need to change the two columns “siteurl” and “home” values.
Click the “phpmyadmin” on your CPanel dashboard under the Databases. A page will be opened you need to click the database on the left and click the “wp_options” table.
Click the “Edit” icon which usually is found at the far left at the beginning of the row and The Edit Field window will appear. In the input box for option_value, carefully change the old domain to the new domain. Finally, verify and save the information. Next, change the home field like before.
Conclusion:
WordPress website migration is easy. You just need to follow steps described in the article and you will have a safe complete migration on your new hosting server. If you find something difficult let us know in the comments below.