When ever I talked about WordPress hosting, I always mentioned that WordPress is memory hogging CMS and you should always go for a Webhosting which is optimized for WordPress hosting. One of my WordPress client, wanted to move WordPress blog from Dreamhost to Hostgator, as Hostgator is one of the best alternative for Dreamhost. Here I will share the complete step by step tutorial to move WordPress site to a new host.
In this case, Dreamhost uses custom cPanel and Hostgator uses standard cPanel. Most of the Web hosting companies like Bluehost, Hostmonster, WpWebhost offers standard cPanel, so if you are moving to any cPanel hosting, this guide will help you to migrate WordPress site.
Moving WordPress to Hostgator Server: Handy Guide
Now, we need to make sure everything moves without any down time. I also suggest to plan out a day like weekend, when you get least traffic. This is to make sure, you will not lose any comments or guest post while migrating.
In this tutorial, we will be moving two things:
- Wp-content folder from old host
- Database of your WordPress site
Information and tool you need to keep handy:
On Dreamhost: Old hosting
Before we export wp-content and database, here we will be doing couple of things.
- Delete all previous database backup
- Delete all Cache files (Empty cache option in your cache plugin)
- Delete all unused plugins & themes
- Delete all Spam comments, Trash comments and trash posts.
We are doing so many cleanup to make sure your database and wp-content size could be as small as possible.
Install Wp-Db manager plugin and optimize database and after optimization, take a backup of WordPress database. If your database size is huge, use the gZip compression else take back up in .MySQL format.
Another thing which we need to take backup of is, Wp-content folder. if you are using cPanel hosting, you can simply login to file manager from cPanel and compress your wp-content folder and take backup, or use any FTP client and take backup of your wp-content folder.
On Hostgator: New Hosting
So far, at Dreamhost we have taken backup of Wp-content and Database and that is all we need to move ahead. Login to HostGator cPanel or new hosting account and Install WordPress on it. You can follow this guide to Install WordPress using fantastico. Along with this, we will be creating a separate Database and a user and associating that user with Db with all the privileges.
Create a Database + User + Associate:
Login to your cPanel and click on Database >MySQL Database Wizard
Here you will be giving a name to your database, creating a MySQL user & password and associating user with that database. Note down all the details in a notepad, as we will be needing it later to make changes in wp-config file.
So, here is the detail of newly created database and all associated details:
- Db Name: unikaman_SML
- Db user: unikaman_SML
- Db password: _xzB-[Cbph.*
So, we are almost half way with our WordPress hosting migration, and now start the hard part. Since, our goal here is to move WordPress hosting with 0 down time, so we will first check everything is alright before migration. For this, we will edit our Windows hosts file, and point our domain to Hostgator server.
On Hostgator cPanel, left side bottom you can find the I.P address of your hosting account and edit your hosts file to point to that I.P. This guide will help you to edit your hosts file and here is what my hosts file look like, replace the domain name with real domain that you are migrating.
What this will do is, it will let you see your site on new Web-host on your machine, where as, everyone else in the world will see your site running on old hosting.
Now, open FTP and login to new hosting FTP. Upload all the content of Wp-content file (Backup from old host) to your new hosting at the same location. public_html/domain.com/wp-content
And on your hosting cPanel, go to Database > PhpMyadmin >Select the database from Left side > Import and upload the backed up database file from old hosting.
If your database size is too huge and can’t be imported with default PhpMyadmin importer, we will use a 3rd party tool call Bigdump. If you need tutorial for importing huge WordPress database, let me know and I will write a separate tutorial for the same.
After importing is finished, click on Structure and note down the database prefix. Here is an example:
So, in this example migration, my WordPress DB prefix is : wp_7agot7_
Once it’s done, all you need to do is edit Wp-config file and add the database information that we created above: Open your wp-config file from root of your WordPress installation (Keep a backup of file before) and edit the details:
Also, search for following line in Wp-Config.php file: $table_prefix =
and replace the prefix with, our Db prefix which we have found using Structure under your Phpmyadmin. Example:
Once you have done everything as mentioned in this tutorial, your site should be successfully migrated to new hosting. Now, all you need to do is verify all settings and make sure everything is working fine. Once you are sure about everything is working fine, go ahead and update Domain name servers to point to new hosting and in this case it’s Hostgator name servers.
Possible problem & solution after WordPress host migration:
After moving WordPress Webhosting company, your directory structure is changed. So, few of your plugins might not be working or you might be facing few issues. Here are some of the common problems which you might face and here are solution to those problems:
Weird Character problem:
At time after migrating MySQL database, you will notice some weird character in your WordPress blog in new host. For example, characters like : Â and â€™.
You can use Search and replace WordPress plugin, to find all such weird characters and replace them all together.
Image Upload problem:
After hosting migration, since your directory structure is changed you might get an error uploading new images. You need to go to Settings > Media under WordPress dashboard, and edit the location of Wp-content directory under “Store uploads in this folder” options.
Similarly, you need to make changes for Wp-db manager or any other database backup plugin you are using to store database on your server. Also, take a note of .htaccess file, as most of the time you end up having a faulty or empty .htaccess file, which gives 404 error for all internal pages. You might like to refix your cache plugin, to update the .htaccess code.
More over, this tutorial looks technical but once you start moving WordPress blogs, you will realize it won’t take more than 30-45 minutes for a perfect migration. Though, time may differ based on size of database, wp-content folder and your skills.
Infact, many of you can consider starting a service based on the same and you can charge from 50-100$ for a hosting migration. Something, which I offer under my WordPress services, from long and it makes decent money with hour of work.
- Take back up of Wp-content and Database on old server
- Edit Hosts file on Local computer
- Install WordPress on new Hosting server
- Upload Wp-content folder
- Create Database, user and password
- Import Database
- Update Wp-config file on new server
- Verify everything
- Update Nameserver to point to new hosting
- Share this post
I hope this tutorial will help you to move WordPress site with Zero downtime, but if you are stuck anywhere, don’t forget to give me a shout for help via comment. If you find this tutorial useful, don’t forget to share it on Google plus and Facebook.
Get Free Blogging updates in your Email