How To Migrate a WordPress Site To New Host: Zero Downtime
If you want to migrate a WordPress site to the new hosting, this guide will help you to understand what to transfer all the files and how to do it yourself. Before we proceed to WordPress hosting, let we share back story behind writing this DIY (do it yourself) tutorial.
One of the WordPress clients wanted to transfer a WordPress blog from Dreamhost into a Hostgator because Hostgator is one of the best options from DreamHost. Here we will share the entire step by step tutorial for moving WordPress site to a new host.
In this case, DreamHost uses custom cPanel, and Hostgator uses standard cPanel.
Most popular web hosting companies like Bluehost, SiteGround provide standard cPanel, so if you are going to any cPanel hosting, then this guide will help you migrate your WordPress site.
Moving WordPress Site to New Host
Ok, so it’s time you leave your web hosting and go to the new hosting for your WordPress blog. In this tutorial, I am taking the example of HostGator hosting and this process will be similar to almost all web-hosting companies.
Now, we need to make sure that everything runs continuously without any downtime. we also suggest planning a day like a weekend, when your website gets the least traffic.
This is to be ensured; When migrating, you will not lose any comments or guest posts.
In this tutorial, we will carry two things:
- WP-content folder from the old host
- Database of your WordPress site
- Taking the backup of WP-Config file
Information and tools that you have to handle:
- New Hosting Info
- Old Hosting Info
- FileZilla or any other free FTP tool
On Dreamhost: Old hosting
Before we export wp-content and database, here we will do a few things.
- Remove all previous database backups.
- Delete all cache files (empty cache options in your cache plugin).
- Delete all unused plugins and themes
- Delete all spam comments, garbage comments, and garbage posts. You can take help of the WP Sweep plugin to do all this quickly
We’re doing many cleanups to make your database and wp-content size as small as possible, to make sure.
You can install the WP-Db Manager plugin and optimize the database and after the optimization, you can back up the WordPress database. If your database size is large, then use gZip compression. Backup in SQL format.
Another thing we need to backup is the WP-content folder. If you are using cPanel hosting, you can simply log in to the file manager from cPanel and compress and backup your wp-content folder, or you can use any FTP client And back up your wp-content folder.
On HostGator: New Hosting where you want to transfer to WordPress
So far, in DreamHost hosting, we have backed up the WP-content and WordPress database, and that’s all we need to move forward. You should also download the WP-config file, which is in the root folder of your FTP.
Now, prepare our new hosting to proceed to the WordPress site.
Log in to HostGator cPanel or new hosting account and install WordPress on it. You can follow this guide to install WordPress using Fantastico. With this, we will create a separate database and a user and will associate that user with DB with all the privileges.
Remember that this migration process may be risky so its better take a look at our WordPress migration services.
Create a Database + User + Associate:
Login to your cPanel and click on Database> MySQL Database Wizard
Here you are giving your database a name, creating a MySQL user and password and adding the user to that database. Note all the details in Notepad, because we will later need to make changes to the wp-config file.
So, here’s a description of the newly created database and all related details:
- Db Name: unikaman_SML
- Db user: unikaman_SML
- Db password: _xzB-[Cbph.*
Therefore, we are almost halfway with our WordPress hosting migration and now start the difficult part. Since our goal is to transfer WordPress hosting with 0 downtime, so we will first check that everything before the migration is all right. For this, we will edit our Windows Host file, and our domains will point to the Hostgator server.
At Hostgator cPanel, on the left side, you can find the .ip address of your hosting account and edit your host file to point to that IP. This guide will help you edit your host’s file and look like my host file here, replace that domain name with the actual domain that you are migrating to.
What it does, it will allow your site to be viewed on the new web-host on your machine, while all the people in the world will see your site running on old hosting.
Now, open FTP and login to the new hosting FTP. Upload all the contents of the WP-content file (backup from the old host) to your new hosting in the same place. public_html / domain.com / wp-content
And on your hosting cPanel, select Database>>PHPMyAdmin>>Database from the left side>>Import and upload the supported database file from the old hosting.
If your database size is too large and by default, the PHPMyAdmin cannot be imported by the importer, then we will use Bigdump to call third-party tool.
If you need a tutorial for importing a large WordPress database, then let me know, and I will write a different tutorial for that.
After the import is complete, click on the structure and note the database prefix. Here’s an example:
Therefore, in this example migration, my WordPress DB prefix is: wp_7agot7_
Once this is done, you only have to edit the Wp-config file and add the database information that we created: Open your wp-config file from the root of your WordPress installation (keep a backup of the details) Edit more details:
Also, find the following line in the Wp-config.php file: $ table_prefix =
And replace the prefix, our DB prefix we have found using the structure under your PHPMyAdmin. Examples:
Once you have done everything according to the instructions in this tutorial, your site should be successfully migrated to new hosting. Now, all you have to do is verify the settings and make sure everything is working properly.
Once you make sure that everything is working properly, then go ahead and update the domain name server to point to the new hosting and in this case, this is the Hostgator nameserver.