Migrate a WordPress
One of the biggest risk involved in either switching the hosting of a WordPress website or migrating a WordPress site entirely to a new server is chances of data loss and website downtime. We generally tend to pick up a particular hosting just based on the price on which it is offered but this should not be the case. Both the quality of hosting as well as the price should be taken into consideration before finalizing on a place to host a WordPress website. If this is not taken care of, we might need to migrate a WordPress website to another host the process of which is explained in detail below. There are a few WordPress hosting companies that offer free migration service and if not explicitly stated, we can always ask if such a feature is available. Nevertheless, let us have a look at the steps involved in order to migrate a WordPress website from one host to another.
Step 1: Choose the new host for your WordPress website
If we observe that despite all our efforts to optimize the speed and performance of our site, we are stuck with a slow WordPress site, then it’s time to move to a new host which can better handle the traffic on our site and is more suited and optimized towards our requirements. It is recommended to choose really carefully out of the available options so that we do not have to perform the process of migration anytime soon. Some of the things to look out for depending upon individual requirements are:
- Shared Hosting
- Cloud Hosting or Location-specific providers
- Dedicated Servers
- Managed WordPress hosting
Once we have bought the hosting, it is not advised to install WordPress. This is to be done at a later stage. Let the hosting account be completely empty with no files and folders in it.
Step 2: Set up Duplicator
We need to install and activate the Duplicator plugin on the WordPress site we wish to migrate. This is preferred because we can migrate WordPress website from one host to another without loss of Search Engine Optimization (SEO).
After installing and activating Duplicator, go to Duplicator -> Packages on the WordPress admin panel. Click on the Create New button. Then follow the next steps to create the package. Once the scan results show everything as Good, click on Build. Once the process is complete, download both, the Installer (this automates the installation process) and the Archive (copy of the website) package using the ‘One-click download’ link.
Step 3: Import WordPress site to the new host
Now we need to upload the installer and archive files generated in the previous step to the new host using FTP (File Transfer Protocol). In order to connect to the FTP client, we would require the server’s IP Address and server hostname and not the website domain name as our domain name is still pointing to the old host. The required information can be found on the new host cPanel dashboard.
Using the FTP client, we need to upload installer.php and the archive.zip files to website’s root directory. The root directly is usually ‘/username/public_html/’ folder.
We need to ensure that the root directory is completely empty, if the host has already installed WordPress for us then we need to delete it. Then we need to upload the installer and archive file to this directory.
Step 4: Change the host’s file
After uploading both the installer and archive files, we need to access the installer file through a browser. If we go to the URL <domain_name>/installer.php, we will be taken to the old host and we will get a 404 error as our domain is still pointing to the old host.
We need to edit the host’s file to access the new host on our browser.
- On Windows, we need to open Notepad with Administrator privileges. Open C:\Windows\System32\drivers\etc folder and open the host’s file.
- On the Mac, we need to enter the following command in Terminal to access the host’s file: sudo nano /private/etc/hosts
- For both Windows and Mac, at the bottom of the host’s file, add the following line: <IP_Address of the new host><space><Domain Name>
Now, we can access the new host using the domain name on our computer.
The above change must be undone after completing the migration process, i.e., Step 6.
Step 5: Create MySQL Database
Before executing the installer, we need to create a MySQL database on the new hosting account.
In order to do this, click on the MySQL Database in the Database section of the cPanel dashboard. Provide a name and click on Create Database.
Once the database is created, we need to go to the MySQL users section and provide a username and password to create a new user.
Once the user and database both are created, we need to add the user to the database in the Add User to a Database section. Now the database is ready to be used with WordPress. We can now proceed to migrate a WordPress site to the new host.
Step 6: Begin the migration process
Now we need to navigate to the address ‘<domain_name>/installer.php’ on our browser. Here a few tests will be run and we need to accept the terms and conditions.
Once all the steps are completed, we get a Site Login option to log in to WordPress on the new host to ensure everything is behaving as expected.
Now, we have successfully completed the process of migrating a WordPress site to the new host.
Step 7: Update the Domain
We need to switch the DNS nameservers to ensure that our domain name no longer points to the old host but the new one. If the domain is registered with the old hosting provider, then it is recommended to transfer it to our new host. If our domain name is registered with domain registrar like Godaddy, then we need to update the nameservers present there.
In the domain management area, we can find nameservers which are to be updated. Here, we need to provide the information corresponding to the new host. These changes might take somewhere around 48 hours to propagate across all the website users. Since the old and the new host contains the same content, our website will have no downtime even during this process.
These are the steps which we need to follow to migrate a WordPress site from one host to another. All the information about the new host can be found on the cPanel dashboard and it is recommended to contact the customer support if we face any issues in locating any specific information. In case of any issues, we can head to the WordPress forum and look up to the issues pertaining to migration using Duplicator. To ensure zero downtime, it is advised to do not cancel the old hosting for around a week after the migration process is complete so that the nameservers get properly updated across all users of the WordPress website.
Brandon Graves is a WordPress Geek with a profound Knowledge of migrate WordPress website services.
Please follow him on Facebook, if you want instant updates from him.