Whenever I talk about WordPress hosting, I always mention that WordPress is a memory-intensive CMS, so you should choose a web host that is optimized for WordPress hosting. Many newbies make the mistake of choosing a host based on price, which is not the right decision because you should consider both price and hosting quality to make the right decision. Here are some of the best WordPress hosts that you should go with .
If you are considering migrating your WordPress site to a new host, this guide will help you understand which files need to be migrated and how to do it yourself. Before I get into the steps to migrate your WordPress host, let me share the behind-the-scenes story of writing this DIY tutorial.
One of my WordPress clients wanted to migrate his WordPress blog from Dreamhost to Hostgator because Hostgator is one of the best Dreamhost alternatives. Here I will share the complete step by step tutorial to help you migrate your WordPress site to a new host.
In this case, DreamHost uses a custom cPanel, while HostGator uses a standard cPanel .
Most of the popular web hosting companies like Bluehost , SiteGround offer standard cPanel, so if you are migrating to any cPanel hosting, this guide will help you migrate your WordPress website.
How to Migrate a WordPress Site to a New Host (Hostgator Server): A Practical Guide
Well, it’s time to say goodbye to your bad hosting and migrate your WordPress blog to a new host. In this tutorial, I will use HostGator as an example, but the migration process is similar for almost all hosting companies.
So I am assuming that you have already purchased HostGator hosting, if not, you can purchase it using the link below and you will get a 30% discount on the total cost.
Get Hosting from HostGator Now > (30% off)
Now, we need to make sure everything runs smoothly with no downtime. I also recommend planning for a day when your website traffic is lowest, like a weekend.
This is to ensure that you don’t lose any comments or guest posts when you migrate.
In this tutorial we will move two things:
- WP-content folder from old host
- Your WordPress website's database
- Backing up WP-Config files
The information and tools you need to always have at your fingertips:
- New host information
- Old hosting information
- FileZilla or any other free FTP tool
On DreamHost: Old Hosting
Before we export wp-content and our database, we're going to do a few things here.
- Delete all previous database backups
- Delete all cache files ( Clear Cache option in cache plugin )
- Remove all unused plugins and themes
- Delete all spam comments, junk comments, and spam posts. You can follow my tutorial on optimizing your WordPress database to reduce your database size. This will help the migration complete faster and more accurately.
We are doing a massive cleanup to ensure your database and wp-content size is as small as possible.
Once you have cleaned and optimized **your database , **back up your WordPress database . If your database is large, compress it with gZip, otherwise back it up in .SQL format.
Another folder we need to back up is the WP-content folder . If you are using cPanel hosting , you can directly log in to the cPanel File Manager, zip the wp-content folder and backup it, or use any FTP client to backup the wp-content folder.
On HostGator: New Host, Where Do You Want to Migrate WordPress to
So far on DreamHost hosting, we have backed up WP-content and the WordPress database, and that's all we need next. You will also need to download the WP-config file in the FTP root folder.
Now let’s prepare the new hosting to migrate the WordPress site.
Log in to your HostGator cPanel or new hosting account and install WordPress . You can follow this guide to install WordPress using Fantastico . In addition, we will create a separate database and a user, associate the user with the database, and give it all permissions.
Create database + user + association:
Log in to your cPanel and click Databases > MySQL Database Wizard
Here you will name the database, create a MySQL user and password, and associate the user with the database. Jot down all the details in a notepad as we will need it later to modify the wp-config file.
So, here are the details of the newly created database and all the relevant details:
- Database name: unikaman_side
- Database user: unikaman_side
- Database password: _xzB-[Cbph. *
At this point, we are almost halfway through the WordPress hosting migration, and now we are going to start the hard part. Since our goal is to achieve zero downtime for the WordPress hosting migration, we first need to check if everything is working properly before the migration. To do this, we will edit the Windows hosts file and point the domain name to the HostGator server.
On the bottom left of the HostGator cPanel you can find the IP address of your hosting account and edit your hosts file to point to that IP. This guide will help you edit your host’s file , this is what my hosts file looks like, replace the domain name with the real domain you are migrating.
The purpose of this is that you will see your site on the new web host on your machine, while the rest of the world will see your site running on the old host.
Now, open FTP and log in to the new host's FTP account. Upload all the contents of the WP-content file (backed up from the old host) to the same location on the new host. public_html /domain.com/wp-content
On your hosting cPanel, go to Databases > PHPMyAdmin > Select Databases from the left > Import from old hosting and upload the backed up database file.
If your database is too large to import via the default PHPMyAdmin importer , we will use a third-party tool called Bigdump .
If you need a tutorial for importing a large WordPress database , let me know and I will write a separate tutorial for it.
Once that’s done, all you need to do is edit the wp-config file and add the database information we created above: Open your wp-config file from the root directory of your WordPress installation (keep a backup of the file before) and edit the details:
//** MySQL settings - You can get this info from your web host **//
/** The name of the database for WordPress */
define('DB_NAME', 'unikaman_side)
/** MySQL database username */
define('DB_USER', 'unikaman_side')
/** MySQL database password */
define('DB_PASSWORD', '_xzB-[Cbph.*')
/** MySQL hostname */
define('DB_HOST', 'localhost')
Also, search for the following line in your wp-Config.php file: $table_prefix =
And replace the prefix with the Db prefix we found under PHPMyAdmin using Structure. Example:
After completing all the steps mentioned in this tutorial, your website should have been successfully migrated to the new host. Now, you just need to verify all the settings and make sure that everything works fine. Once you have verified that everything is working fine, go ahead and update your nameservers so that they point to the new host (in this case, the HostGator nameservers) .
Possible problems and solutions after WordPress host migration:
After migrating your WordPress hosting company , your directory structure will change. As a result, some of your plugins may not work properly or you may encounter some issues. Here are some common issues you may encounter and their solutions:
Weird character problem:
After migrating your MySQL database, you may notice some strange characters appearing in your WordPress blog on the new host. For example:  and ’.
You can use the Search and Replace WordPress plugin to find all these weird characters and replace them all.
Image upload problem:
After a hosting migration, you may experience errors when uploading new images because the directory structure has changed . You need to go to Settings > Media under your WordPress dashboard and edit the location of the WP-content directory under the " Store uploads in this folder " option.
Likewise, you’ll need to make changes to WP-DB Manager or any other database backup plugin you use to store databases on your server .
Also, keep an eye on your .htaccess file because most of the time your .htaccess file will be wrong or empty, resulting in 404 errors on all internal pages. You may need to reset your WordPress cache plugin to update the .htaccess code.
This tutorial may seem very technical, but once you migrate your WordPress blog, you will find that a perfect migration only takes 30-45 minutes. However, the actual migration time may vary depending on the size of your database, the size of your wp-content folder, and your skills.
In fact, many of you may consider starting a service based on this and charging $50-100 for a managed migration.
Quick Recap:
- Back up your WP content and database on the old server
- Edit the Hosts file on your local computer
- Installing WordPress on your new hosting server
- Upload the WP-content folder
- Create a database, user, and password
- Importing a database
- Update WP-config file on the new server
- Verify everything
- Update the name servers to point to the new host
- Enjoy your website on the new host
I hope this tutorial helped you migrate your WordPress site with zero downtime, but if you face any problems, don’t forget to leave me a message in the comments for help. If you found this tutorial useful, don’t forget to share it on Twitter and Facebook.
Further reading:
- Kinsta Managed Hosting Review: Is It Worth the Money and the Hype?
- Web Hosting with Free Website Migration
Disclosure: Some of the links in this article contain affiliate links, which means we may earn a commission if you click through to visit us, at no extra cost to you. See how SidelinePlay is funded, why it’s important, and how you can support us.
Was this helpful?