How to move WordPress site to another server with zero downtime

The Hunchback of Notre Bresil

Here is step-by-step tutorial on how to move your WordPress site with zero downtime.

  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 names ervers 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.

See also:


Posted in: WordPress
TAGS:, , , , , , , , , , , , , , , , , , , , , , ,
Leave a comment

37 Comments

  1. Neil Abraham
    Feb 2nd, 2010

    I followed all these steps BUT my links now don't work.

    I grabbed a backup of the old site, then I used fantastico to install a new Wordpress account on my new server.

    I then did a "drop" of the contents of the new MySQL database and did a restore from the backup .sql file, which seemed to go ok.

    I uploaded all the old files provided, like templates, etc. I modified the config file to know the new database name and created the correct username and password on the server.

    I then changed the name servers to point to lunarpages and this morning it all came up looking like it was going to work.

    The front page comes up and looks fine.

    I can log into the wp-admin and everything there seems to work fine, all the old pages are listed and I can even modify the article called "home" and the changes appear fine on the website.

    BUT - none of the links from the front page work. They all give a 404 error.

    For example "about us" permalink listed in the admin editor matches the link that appears when you click the about us link on the front page, yet the two are not matching up

    Any idea why?

  2. david fu ta wei modif-and-otomotif.blogspot.com
    Dec 28th, 2009

    nice post.. do you agree to exchange link with me

  3. Kumaran hddvdrecorder.org
    Dec 24th, 2009

    thanks a lot Vladimir. actually i don't know that one can transfer a wordpress site without downtime.

  4. hagel IT-Service hagel-it.de
    Dec 19th, 2009

    Thanks for the tips. We will try.

  5. Bill Kyle fitnesshealthplan.com
    Dec 13th, 2009

    Vladimir, this works great. I just had to change Host. I used your procedure for a check list. When the nameserver changed in a few hours, every thing fell right in place. I don't think I had any down time.

    Thanks Bill

  6. Sohail Ahmed freetradeforum.com
    Nov 28th, 2009

    Nice tip! Thank you Mr. Vladimir :)

  7. Andy dtechit.co.uk
    Oct 28th, 2009

    Very useful info on here as this process is full of pitfalls for the unwary. Just be sure to trace your steps so that you can always return.

  8. bisnis internet blogbisnisinternet.com
    Sep 25th, 2009

    Thanks for sharing good information, i learn how to move wordpress here.

    Keep posting.

  9. Delton realsmartsite.com
    Aug 9th, 2009

    I have changed servers and I've changed the wp_config.php but I still can open my blog nor can I get admin
    to open. All I get is a blank page. Anybody have any suggestions

  10. Seth Goldstein goldsteinmedia.com
    Aug 3rd, 2009

    So will this work if I want all the widgets and plugins and settings to remain the same? I want to be able to just move it over to another server and have it be the same as it was on the previous server. Is this possible.

  11. Thorsten Albrecht
    Jul 16th, 2009

    Before I could activate my migrated wordpress installation (I just duplicated my installation on the same server) I had to change the value 'siteurl' in the database table "wp-options" by hand. Otherwise I would have been redirected to the old wordpress installation.

    Thorsten

  12. Make Money Easy Online makemoneymall.com
    Jun 30th, 2009

    Hi Guys.

    I am just wondering. Will it be possible to install a fresh copy of Wordpress and over write the new database with old database?

    Care must ensure that both copies of the Wordpress MUST be of the same version to prevent conflicts?

    I am going to change server soon and it is getting me paranoid with so many suggestions and ways to move a Wordpress blog.

  13. charlie darkhorsestudios.co.za
    Jun 24th, 2009

    i have recently aquired a new domain name for a different site i want to start, now i have been thinking of using my pc at home as a temporary server to install wordpress onto and get the look of it right before i let the new site "go live to the world" as it were. now if i move my files over to a new server, when i am ready, can i delete all the files on my pc(server) at home without it having any effect on the functionality of my new site??? in oher words once the files are on the new server, does it matter or not if the old one"my pc" is offline/no longer working/sold for spare parts.....?

  14. Bob
    Mar 31st, 2009

    I did all that and yet my categories and posts still point to old server. Dis I miss something? Everything else goes to new server.

  15. Jim tripawds.com
    Mar 30th, 2009

    What awesome help this would be, if I could make it work. Do you know of anything else that might keep my WP install from connecting to my new dedicated server?

    I've created and imported the database and user with full access on our new box. I edited my wp_config with the correct details including new host name. I enabled the cPanel option to allow Remote MySQL access to the new server.

    My site and forums currently reside on a 1and1 shared hosting account. The old/current database resides on some 1and1 server at mydb.perfora.net (not localhost), so I should easily be able to run from mynewdb.mynewbox.net ... alas, I only get "Error Connecting to Database".

    One suggestion was that 1and1 may blocking the connection from that end. All ideas welcome. Thanks!

  16. Jae Jun oldschoolvalue.com
    Mar 26th, 2009

    Thanks for the tip.. Looking to switch as soon as possible. My current dead beat host has been down 8+ hours 2 days in a row.

    FYI for anyone interested, never go with Strikedata.com

  17. My Life Thinking mylifethinking.com
    Mar 20th, 2009

    This is great, I have moved my blog and connected it to another database, thanks!

  18. weight loser everythingblog.net
    Mar 10th, 2009

    Gee thanks, I must learn how to do that because I need to move my blog to a better server :-)

  19. wvengen
    Feb 9th, 2009

    This has one downside: when users dns' isn't updated yet and they visit the old site and update the site, these changes are not reflected on the new location. There are two remedies:
    1. Migrate the database and make both locations point to the same database.
    2. Allow two domains in wordpress (don't know how to do that though), create new.domain.tld to point to the new server, and redirect http://www.domain.tld to new.domain.tld on the old server. This is a new dns record which which will always point to the new server if it didn't exist beforehand.

  20. John James Jacoby johnjamesjacoby.com
    Dec 9th, 2008

    This is a good post, but I am curious how the media folder is updated to accommodate this change? Since the database seems to house a the absolute path to files in the uploads folder, switching to a new host will obviously change that absolute path.

    It seems to me that unless WordPress is savy enough to update the many files in the database with the new absolute path, that all of your attachments would be missing using this method.

  21. Jim Keefer lawyersearchnow.com
    Nov 28th, 2008

    I'm not clear on moving from one C panel to another C Panel on a new server?

  22. Anonymous
    Nov 6th, 2008

    @doug -

    How did you do that, Doug?

  23. Jay McGillicuddy jaymcgillicuddy.com
    Oct 24th, 2008

    I moved to a new host a couple of months ago and my biggest problem was I forgot to change the config file.

    I wish I had seen this first.

  24. Tester sa.com
    Oct 11th, 2008

    Toi muon thu ma thoi

  25. Rudy amid.com
    Oct 4th, 2008

    I'm planning to move my blog to a dedicated hosting site soon. My biggest concern is them trying to take over my domain name. Their tech support assured me they won't do a domain name transfer, but I'm a bit skeptical.

  26. Ryan McMillan ryanmcmillan.com
    Oct 1st, 2008

    Thanks for this! So simple!

    Great job!

  27. Blog Design Studio blogdesignstudio.com
    Sep 30th, 2008

    Well, I'd written a similar post and I hope you find that useful too. I loved your post title by the way and that is what actually enticed me to look at the post. Great article.

  28. Hanep hanep.org
    Sep 30th, 2008

    Good info... it's better with no downtime..

  29. Susan eforeclosurepedia.com
    Sep 29th, 2008

    An awesome tutorial! Well done, and thanks for putting that together.

  30. Predrag Supurovic pedja.supurovic.net
    Sep 29th, 2008

    Before you start all this process, check if new host allows direct access to database server remotely. It is common that database is accessible only on localhost, for sake of the security.

    If that is the case with your new server, you would not be able to connect to database from your old site.

  31. doug
    Sep 29th, 2008

    Good info. If you use cpanel and are moving to another cpanel host, you can actually transfer the new site completely from the new cpanel without downloading anything. I was able to transfer a number of wordpress sites in about 10 minutes or so with cpanel. So be sure to keep that in mind if you are pondering a switch. if you are not using a host that provides cpanel and are planning a move, make sure to seek out one that offers cpanel for management.

  32. Spartak kvasac.com
    Sep 29th, 2008

    Great, I didn't know that ; /
    I made a mistake, I do everything on the same way like you sad but with no step 2 :D.

  33. Vladimir prelovac.com
    Sep 29th, 2008

    If you follow step 2 you will have no downtime and no lost comments!

  34. Spartak kvasac.com
    Sep 29th, 2008

    Very nice and easy to understand explanation.
    Maybe its better to put some text on your site while moving it to another server, something like, please came tomorrow or under construction because i have problem with comments.
    I change my host one week ago and lose some comments. They send comments but on old host and they never came to my new site. ;)

  35. Paulux
    Sep 29th, 2008

    Hi, this could be works if I migrate my wordpress site to my local machine????

    Thks

  36. Vladimir prelovac.com
    Sep 29th, 2008

    I am glad this helps. I am also glad to hear the site is faster for you, that was one of the main reasons I moved. The other being security issues.

  37. Abang Long wansuhaimi.co.cc
    Sep 29th, 2008

    Well done and thanks for the valuable info since I also have the intention to switch my server to a better one.

    In fact, I notice that your website now loads more quickly than before.

Have your say

Your email is never published nor shared. Required fields are marked *

*
*

Subscribe without commenting

About Vladimir

vladimir prelovac Hi! My name is Vladimir Prelovac. I am a computer engineer by profession and an adventurer by state of mind.

"I would love to change the world, I just don't have the source code yet."

Books by Vladimir

WordPress Plugin Devleopment Book WordPress Plugin Development: Beginner's Guide

Published by Packt Publishing, available online through Amazon. Click the image for more information.

Consulting Services

Professional WordPress Services, including custom developed plugins and themes

Expert on-site WordPress SEO consulting and an 'out-of-the-box thinking' approach to problems