How To Move WordPress Site To New Host With Zero Downtime

125Shares

Whenever I talked about WordPress hosting, I always mentioned that WordPress is memory-hogging CMS, and you should always go for a Web hosting, which is optimized for WordPress hosting. Many newbies make mistake by picking the hosting based on price which is not the right decision as you should consider both Prices & hosting quality to make the right decision.  Here are the best WordPress hosting that you should be using.

If you are looking to move WordPress site to new hosting, this guide will help you understand what all files to move & how to do it yourself. Before we move to the steps of moving WordPress hosting, let me share the backstory behind writing this DIY tutorial.

Move WordPress Site To New Host
  • Save

One of my WordPress clients wanted to move a WordPress blog from Dreamhost to Hostgator, as Hostgator is one of the best alternatives 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 popular Web hosting companies like Bluehost, SiteGround offers standard cPanel, so if you are moving to any cPanel hosting, this guide will help you to migrate WordPress site.

How to Migrate WordPress Site to New Hosting (Hostgator Server): Handy Guide

Alright, so it’s time to leave your crappy hosting & moving to new hosting for your WordPress blog. In this tutorial, I’m taking the example of HostGator hosting & the process would be similar for almost all the web-hosting companies.

So, I assume you already have purchased HostGator hosting, and if not, you can use coupon code “ShoutMeLoud30” to grab 30% off on the total bill.

Grab Hosting from HostGator now> (30% discount)

Now, we need to make sure everything moves with no downtime. I also suggest planning out a day like a weekend, when your website gets the least traffic.

This is to make sure; you will not lose any comments or guest post while migrating.

In this tutorial, we will move two things:

  • WP-content folder from the old host
  • Database of your WordPress site
  • Taking backup of WP-Config file

Information and tool you need to keep handy:

  • 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 be doing a 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. You should follow my tutorial on optimizing WordPress database to reduce the DB size. This will help in faster and error-free migration.

We are doing so many cleanups to make sure your database and wp-content size could be as small as possible.

After cleaning the database and after optimization, take a backup of WordPress database. If your database size is huge, use the gZip compression else take backup in .SQL format.

Another thing which we need to take the backup of is the WP-content folder. If you are using cPanel hosting, you can simply log into file manager from cPanel and compress your wp-content folder and take a backup, or use any FTP client and take the backup of your wp-content folder.

On HostGator: New Hosting, where you want to move WordPress

So far, at DreamHost hosting, we have taken a backup of WP-content and WordPress Database, and that is all we need to move ahead. You should also download WP-config file which is in the root folder of your FTP.

Now let’s prepare our new hosting for moving WordPress site.

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 create 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

Create Database
  • Save

Here you will be giving a name to your database, creating a MySQL user & password and associating the user with that database. Note down all the details in a notepad, as we will need it later to make changes in the wp-config file.

WordPress Database user & pass
  • Save
Database Privilage
  • Save

So, here is the detail of the newly created database and all associated details:

  • Db Name: unikaman_SML
  • Db user: unikaman_SML
  • Db password: _xzB-[Cbph.*

So, we are almost halfway with our WordPress hosting migration and now start the hard part. Since our goal here is to move WordPress hosting with 0 downtimes, so we will first check everything is all right 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 host’s file and here is what my hosts file look like, replace the domain name with the real domain that you are migrating.

0 downtime migration
  • Save

What this will do is, it will let you see your site on new Web-host on your machine, whereas, everyone else in the world will see your site running on the old hosting.

Now, open FTP and login to new hosting FTP. Upload all the content of the WP-content file (Backup from the 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.

Import WordPress Database
  • Save

If your database size is too huge and can’t be imported by default PHPMyAdmin importer, we will use a 3rd party tool call Bigdump.

If you need a 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:

WordPress Db prefix
  • Save

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 the root of your WordPress installation (Keep a backup of file before) and edit the details:

Editing wp-config file
  • Save

Also, search for q 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:

WordPress Database Prefix
  • Save

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 face a few issues. Here are some of the common problems which you might face, and here are the solution to those problems:

Weird Character problem:

After migrating MySQL database, you will notice some weird character in your WordPress blog in the new host. For example, characters like:  Â and ’.

You can use Search and replace WordPress plugin, to find all such weird characters and replace them altogether.

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 the 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 the 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 reset your WordPress cache plugin, to update the .htaccess code.

This tutorial looks technical, but once you move WordPress blogs, you will realize it won’t take over 30-45 minutes for a perfect migration. However, time may differ based on the size of the database, wp-content folder, and your skills.

In fact, many of you can consider starting a service based on the same, and you can charge from 50-100$ for a hosting migration.

Quick recap:

  1. Take back up of WP-content and Database on the old server
  2. Edit Hosts file on Local Computer
  3. Install WordPress on the new Hosting server
  4. Upload WP-content folder
  5. Create Database, user, and password
  6. Import Database
  7. Update WP-config file on new server
  8. Verify everything
  9. Update Nameserver to point to new hosting
  10. Enjoy your website on new hosting

Update: You can also use WP Duplicator plugin to migrate WordPress blog. Here is a tutorial.

Subscribe on YouTube

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 Twitter and Facebook.

For further reading:

Was this helpful?

Thanks for your feedback!
  • Save
125Shares
Authored By
A Blogger, Author and a speaker! Harsh Agrawal is recognized as a leader in digital marketing and FinTech space. Fountainhead of ShoutMeLoud, and a Speaker at ASW, Hero Mindmine, Inorbit, IBM, India blockchain summit. Also, an award-winning blogger.

43 thoughts on “How To Move WordPress Site To New Host With Zero Downtime”

  1. Andhika Wiratama

    Thanks Harsh,
    I was the difficulty in moving the server, this information is very useful.

    Good Luck

  2. Sanjeev

    Thanks Harsah, Just followed your tutorial to transfer my site for the second time.

    1. Harsh Agrawal

      @Sanjeev
      Glad it helped..And guess what? I also refer to my own article, when moving any WordPress site. 😉

  3. Muhammad Imran

    Everything is just great. I have one question, why we need to edit host file, in case as you explain by changing host file we will see our site through new host, if someone comment on our site then how we will get notified? Because we are surfing our site via new host and users are through old host. Comments will be removed during dns propagation time because they will be store at old host. So how we will be get notified in this cindition?
    Am I correct ?

    Regards,
    M Imran

  4. Mike

    I just wanted to let you know, I use this method every single time I take a website from dev on my server to live on my client’s server. It has worked flawlessly every time. I’d be in a world of hurt if I hadn’t found your tutorial the first time I did this and bookmarked it.

    Thank you so much for your generosity and for sharing!

  5. David

    I am getting a white screen on mine. Followed the steps as best I could which I thought was correct but something seems to be amiss. Let me know if you have any thoughts about that. Thanks!

  6. kingsley

    Thanks buddy,

    Just followed your tutorial to transfer my site for the second time

  7. Alex Taylor

    Hi,
    I wanna a ask that Is there is any extra step required for SSL website??? and would I require to disabled hosting then do SSL on VPS after its all migrated?

  8. Alex

    How is this “Zero downtime?” Propagation still plays a part, your site appears offline while it takes place. I even left my old server/hosting as is while it took place and it still doesn’t connect while propagation is happening.

    1. Harsh Agrawal

      @Alex
      You edit your hosts file to access your new hosting and where as world will see the existing site. When you change DNS, world will either see old site (considering you haven’t deleted it after moving) and once DNS propagation happens globally, everyone will see the new site. Technically your website is never down for a second for search engines and also for readers!

  9. Milan

    Million Thanks To Mr.Harsh.

    I followed each and Every Step So that I could move my wordpress site to new host. This Method Works Perfectly. 🙂 🙂

  10. Mukul Bansal

    Thank you so Much harsh…. I had to shift my wordpress website from my old hosting to the new hosting I purchased few days back. I followed the above mentioned steps and successfully moved my wordpress site

  11. Mike

    After doing this, everything looks good with site but when I try to login I’m getting “You do not have sufficient permissions to access this page.”

    Any ideas??

  12. Chris H

    I figured it out… Importing into the new database that was manually created and modifying the wp-config.php to point to it. Ignoring the DB that was created when WP is installed.

  13. Chris Harris

    Thanks for putting this together. A couple things don’t make sense and I’m stuck on them. I’ve copied the content and imported the DB however I see the blank generic WordPress on the new host.
    1) You show creating a mySQL database manually, however you also show installing wordpress using a wizard which also creates a database.
    2) You show editing the wp-config.php in the root of the new wordpress, however that file was never overwritten and it already has the settings of the new hosting company database. Your steps only overwrite wp-content, so the wp-config.php in the root would already be configured for the new hosting companies database.

    1. Harsh Agrawal

      1) Chris we can also use the database created with WordPress installation, but to simplify the process…I asked to create database manually, as we will have all the information.
      2) This will be used when you import the database from old host and need to change the database prefix.
      Hope this helps…

  14. Tarcea Willis

    Man thanks so much for this. You helped me move my primary site without the issues I had previously with trying to move sites. LIFESAVER! lol…Well, Sitesaver! Thanks man…

  15. Felix Albutra

    Hi Harsh,

    Last few weeks ago, I’ve been looking for WordPress Migration tutorial and most of them don’t cover the detailed part. But upon doing some practice, I was able to get it done perfectly with the 100% content intact as well as the design from my localhost to my server.

    Your tutorial will be a great help for future reference, in case I forgot something because you need to do this kind of tasks over and over to master it. Thank you very much for documenting this tutorial. It was a big help.

    – Felix

  16. Prateek

    The steps are nice but I think Hosgator gives one free cpanel transfer on new accounts and you can also buy cpanel transfers from them and they are reliable. I prefer using their services to avoid hassle.

  17. Shashank Johri

    Thanks a lot Harsh Aggarwal for such a nice post.I was looking for such an article from a long time no.I tried this a lot times but always failed just because of some wrong steps but now this post will help me a lot..Thanks..

  18. Deepansh Khurana

    Hello, Thank you for this wonderful tutorial. I was finding a good tutorial when suddenly I saw that you shared this link on Facebook. Was never stuck, till the end while following this. 🙂 No problems. All instructions are precise and detailed, just what first-timers like me need. 🙂 The nameservers haven’t changed as of now but I am aware they take time to update and propagate. Thank you once again. You helped me alot.

  19. Ankit

    Thank U Harsh for such a wonderful way to shift WordPress. I was looking for such a nice explanation. I earlier tried it, but there were error due to the fact that I wasn’t changing the image upload folder location.
    Thanks a lot 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
125 Shares