When your website traffic increases, some common problems might surface. For example, the website may load slowly or the traffic may overload the server thus crashing the website. If you are facing such issues with your hosting server, you may want to migrate your website to a better hosting server. In this article, we will see how to migrate your website with zero downtime.
In this guide, we are looking at making the website migration process as simple as possible. This is not a tech-heavy guide, but there will be tech terms involved. You can also take help of your hosting provider’s support team.
How to migrate a WordPress website painlessly with zero downtime
When you migrate a website, you need to backup and copy two things to your new hosting space:
- Content of website
- Database created by old hosting server
A generic migration plugin will backup both content and database of your website after which can restore these backups on your new host with WordPress installed on it.
After migration is over, you can still encounter errors if your files were not copied properly. This could mean extended downtime for your website.
If your problems after migration are on individual post basis, then it could take a whole weekend to fix those. Even the smallest problems can alienate your most loyal visitors if it doesn’t get fixed quickly.
# Does a zero-downtime website migration process even exist?
To achieve a zero-downtime migration process, we will have to do 2 important changes to the standard migration process:
- Use a full backup plugin like Duplicator. This will help us restore the entire site on new hosting space, without installing WordPress.
- Using “hosts” file to locally test and fix errors on the website, from your own system.
1. Using Duplicator Plugin for Quick and Full Website Backup
Duplicator is a simple yet powerful plugin that packs all your themes, plugins, and website custom code into a single package – this includes your WordPress installation as well. That’s right – you don’t have to reinstall WordPress or look at website builders to reconstruct your website.
Since Duplicator backs up the entire website (not just content and database), the chances of any missed files or errors during testing are minimal.
2. What is “hosts” file?
Like a DNS service, “hosts” file maps IP addresses to domain names. In our guide, it will be configured to map your website’s URL to IP address of your new host. So, when you visit the website from your system, it will not go to the old host but instead, will direct to a new host.
While you are testing and tweaking your website installation on the new host from your home system, all other visitors will be sent to the old host location.
WordPress Migration – Full Procedure without any downtime
So finally, our process of end-to-end website migration will look something like this:
- Full Website Backup using Duplicator
- New host configuration
- Restore the backed up files
- Installation of restored package at new host and local testing of the new website
- Finalizing the migration
Step 1: Using Duplicator Plugin to fully back up your website
To install Duplicator, log into your WordPress backend.
- Click Plugins >Add New. Search for “Duplicator” plugin, install and activate this plugin.
- On the left menu bar, click Duplicator>Packages.
- On the Packages menu, click Create New.
- Go to the Requirements tab, check if all requirements pass and click Next.
- On the Scan tab, wait for the scan to be processed and check if all scans show status as Good. Click Build
- On the Build tab, click Archive to download the zip file and click Installer to download the php file.
Your backup is now complete.
Step 2: Configuring new host
Log into your new hosting account. Go to your cPanel admin page. (If you don’t know where it is located, you can check the documentation from your hosting provider).
- In cPanel, under Databases section, click MySQL Databases>Create Database. Give your database a suitable name, and click Create Database
- In the MySQL Database Users section, create a new user by giving him a username and password. Make sure you save this username and password in a blank notepad file.
- In the Add Users to a Database section, select the user and the database you just created and click Add. On the next screen, select All Privileges for this user. This will map the user to the database and grant all privileges to him.
- Finally, click Make Changes button to save these changes.
- Go back to your hosting account page and note down the IP address allocated to your website.
This completes the new host configuration. You will need to save the following preferably in a notepad file:
- New database name
- Its new username and password for the user
- IP address of the new host server
You can also contact the customer support team of your hosting provider to help get all these details.
Step 3: Installing the backed up website at new host
For restoring the website on the new host, you will need to upload the installer.php and archive (.zip) files (from step 1) to the new hosting space, where you will need all the details you captured in step 2.
Ensure that WordPress is not installed on your host before you begin this process.
- Download an FTP client like FileZilla and connect it to the IP address of your new host (not your old host).
- Locate the root folder of your website. It will be/username/public_htmlor /username/public_html/yourdomain.com
- Upload your installer.php and the archive (.zip) file you had downloaded from Step 1.
You have now restored the backup of your old website on your new host.
Step 4: Install the restored package to new host
Before you proceed with this installation, you need to add a new entry into your “hosts” file for your domain and the IP address of your new host.
- If you are a Windows user: Open File Explorer and go to C:\Windows\System32\drivers\etc and locate “hosts” file. Right-click the file and open it with Notepad.
If you are a Mac user: Open the Terminal, type this command:
sudo nano /private/etc/hosts
- In the “hosts” file, go to the last line and type the New Host IP Address followed by a space and then the URL of your website. For example, if the IP of your new host is 192.168.2.22 and your domain name is yourdomain.com then the new line would be
- Save the changes and close the file. (Note that these changes are temporary, you have to reverse these changes after all the tests on your migrated site are completed without any errors).
- Now, open your web browser and type yourdomain.com/installer.php. This runs the installer file which you uploaded in step 3.
- On this screen, enter the new database name, username, and password of its user having all access privileges (you noted these details in Step 2). Click Test Connection after filling the data.
- Once the connection test is successful, read any warnings shown by the installer. If everything is ok, click Run Deployment button to proceed. The database and all your website files will be extracted in this step. This may take more time than usual.
- In the next step, verify the updated URLs and click Run Update.
- In the last step, it will ask you to verify permalinks, images/plugins, clean up the junk, and check the final reports for any migration errors. Click all 4 buttons in order to perform each of these steps.
After everything is successfully completed, you now have successfully duplicated your old website on your new host.
Any changes you make to the theme or plugins will be done on your new host which only you can see. Your visitors will still be directed to your old website at your old host.
Thus, we can achieve zero downtime with this migration process – because while the new host is being configured, your old host is still running like normal.
Step 5: Update DNS to finalize the migration
After setting up your whole website, you need to make the DNS changes permanent for everyone to see the migrated copy of your website to your new host.
Login to your new hosting account
- Under Domains, check for DNS You should get 2 URLs in the below format:
The screens and exact location of this option may be different for each host. You can also contact the support team of your hosting provider to help you locate these options.
- Copy and save these URLs in a notepad file.
- Login to your old hosting account, locate the same page with DNS information.
- Use the 2 new URLs you had copied from your old host to add two custom nameserver records. Check the entered string properly and click OK to save your changes.
- These DNS changes made in the last step will take up to 48 hours to reflect, so you might need to wait for a few days before purging all your website data on the old host.
- Finally, reopen the “hosts” file as shown in Step 4. Delete the new line you had added in Step 4, save and close the file.
Thus, you have fully migrated your website from old host to new host without any downtime. As noted, we used the “hosts” file to bypass DNS server of old host and configure the domain name to new host only for your PC. This helped us avoid any downtime and fix any migration errors before finally publishing the changes to the world.
A website justifies its purpose of being through maximum uptime on the web. Hence, as a website owner, one must ensure that it never goes down; not even when they are processing the website migration. This will maintain the right inflow of traffic and not cause any inconvenience to the requesting visitors.
Catherrine Garcia is a passionate blogger and a freelance Web Developer currently working for WPCodingDev. She along with her group of freelance developers are experts of creating Websites on WordPress.
(This is a guest post. View guest posting guidelines.)