How to move WordPress site to new server with zero downtime

Update: I recommend using ManageWP to easily backup/restore/migrate your WordPress sites.

The Hunchback of Notre BresilIt often comes as a topic and I decided to write a quick tutorial on how to move your WordPress site from one host to another with zero downtime.

I will assume you are familiar with basic operations like database backup and FTP. So in order to transfer WordPress to new server you need to follow these steps:

  1. Backup the database from the old site and import it to the new site. Pay attention to database names.
  2. Change your wp-config.php in the old site to point to the database on the new site. Your old site will now run using database based on the new site and once you change the nameservers new site will have the up to date database. (You may want to check with your new hosting if they allow outside database access first. If not, you can skip this step and transfer the database at the end, when the nameserver change propagated)
  3. Backup your entire WordPress installation from the old site (this will include all your uploads, themes, plugins)
  4. Unpack your WordPress installation to the new site
  5. Change wp-config.php on the new site with new database details
  6. Change the nameservers to point to the new site
  7. That's all now you only need to wait :)

Since nameserver propagation can take up to one day, step 2 allows you to have up to date database at the moment it happens. Downside to this is slower site response in the meantime because site still runs from the old server and the database is on the new. But if you do this over the night or periods of low traffic it won't be that noticeable and you will not lose any comments or other activity on your site.

Update: You can use ManageWP to move a WordPress site with less hassle.


More like this:


Posted in: WordPress
TAGS:, , , , , , , , , , , , , , , , , , , , , , ,
Both comments and trackbacks are currently closed.

70 Comments

  1. Jose
    Aug 28th, 2012 9:15 PM

    Hi, thanks a lot! I have a question, step number 3, I download via ftp my wordpress directories in the old server, and then in the new server I install wordpress, and after that I upload the files I downloaded from the old server?

    I hope you can reply, thanks a lot!

  2. Jun 1st, 2012 9:21 PM

    if you do this over the night or periods of low traffic it won't be that noticeable and you will not lose any comments or other activity on your site.

  3. Chris
    Dec 15th, 2011 8:01 PM

    Hey, I just found a completely free wordpress plugin that will move an entire wordpress site with just a few clicks: http://www.movewordpress.com/

  4. Oct 31st, 2011 10:52 AM

    i want to use ur tips while changing my host for http://www.infoheaps.com
    thanks

  5. Sep 14th, 2011 9:23 AM

    Thank you for your great instructions. But I still came across a question, which I didn't find a solution. How do you move all the links from the blogroll? In particular from a single installation wp 3.2.1 to wp 3.2.1 multisite?

    - Martin

  6. Sep 1st, 2011 1:35 AM

    Ok...Thanks...for the interesting info...good for users :)

  7. Jul 30th, 2011 1:49 AM

    Grat info. Must read before selling on flippa !

  8. Jul 28th, 2011 9:45 AM

    Thanks for this, however something strange is happenong to me.

    I've followed your steps ( not necesarily in that order) and have a working WP install at the new server location. However, instead of pulling all the DB info from the old server install ( posts and other options), it set up a brand new blog, as if it was not pulling anything from the DB.

    However, it must be connecting to the right DB, otherwise I'd get a " error establishing connection" message... Is not that strange?

  9. Jul 10th, 2011 7:36 PM

    But how I change to the all URL to localhost to my domain name in my database ?

  10. Jun 9th, 2011 6:03 AM

    So glad for this blog. Thank you! I am moving a localhost site (Multisite) to Network Solutions. I followed step by step your instructions but I'm getting a "Error establishing a database connection" message in the browser when I check to see if my site transferred. Before I try it again what do you mean by "Pay attention to database names"? I created a new database name when I imported my database copy to NS hosting. I changed all references of localhost to netsolhost and changed the url too. Do these pieces of code look right in my wp-config.php file? Does MySql hostname seem right? It used to be localhost when I ran it locally.

    /** MySQL hostname */
    define('DB_HOST', 'netsolhost');

    and

    define('WP_DEBUG', false);
    define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/wordpress/';
    define( 'DOMAIN_CURRENT_SITE', 'tinasher.com' );
    define( 'PATH_CURRENT_SITE', '/wordpress/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    • Jun 9th, 2011 8:41 AM

      That would mean that WordPress could not connect to it's database.

      Check your host,username and password in wp-config file. Make sure you have imported your database.

      Finally, ask your hosting support for help that's their job.

      • Jun 9th, 2011 2:04 PM

        That's just it... they referred me to your blog. Any help you can give me is appreciated! I'm doing your steps over because I think I replaced localhost and wordpress incorrectly in my mysql dump file and my wp-config file might be off too with the names. NS gives me this tip before I import the database:

        "You will get the best performance from your database if you use the server name in your scripts and code that calls it. If you need the IP address for a database, select it, click "Edit" "

        So this is my question: My "server name" generated by NS is mysqlv101. Should I replace all instances of "localhost" in both places with this? Is host my server name too or is it tinasher.com (my domain)? And does that mean that in my database sql file:

        'http://localhost/wordpress/tinasher/portfolio-2/web/ becomes 'http://tinasher.com/wordpress/tinasher/portfolio-2/web/ ?

        or

        'http://localhost/wordpress/tinasher/portfolio-2/web/ becomes 'http://mysqlv101/wordpress/tinasher/portfolio-2/web/ ?

        And where do I put the IP address?

        I am thrown with all these naming definitions...

        • Jan 17th, 2012 8:52 AM

          Hi Tina,
          I know this is a late reply. But I found what is your problem. But this may help someone else.
          You should give the Server Name generated by NS instead of 'localhost' in config.php

          Change the 'netsolhost' to 'mysqlv101' in the config.php.
          /** MySQL hostname */
          define('DB_HOST', 'netsolhost'); /** Change this line*/

  • ManageWP