Migrating A WordPress Site – Step By Step

These instructions are for sites that run Apache servers, either on Linux or XAMPP.  They may work with others, but have not been tested.

Whenever I develop a new site, or need to make extensive changes to an existing site, I like to do the work on a local install and then migrate the site to the live one.  This is a description of the process I use.  As of this writing, this has been used on WP versions 3.1 through 3.9.1.

Note that if you are changing a live site, it should be ‘frozen’ so no changes  can occur to it while you are working on the modifications. One way to do this is to install a ‘maintenance mode’ plugin that will let viewers know that the site is being modified.

I use two plugins to help in the process:

  1. BackUp WordPress
  2. WP Migrate DB

A. The first set of tasks is to prepare the ‘New’ site:

  1. The purpose of this step is to get WP up and running on the New site.  If you already have it set up on the site, you can probably use it, but sometimes existing content can conflict with the Old site.  It is safer to start the site from scratch.  Create a database and install WP on the New site.  If I am trying to set up a local site from an on-line site, I use xampp on my pc and I try to name the database and site the same as the live site, but this is not strictly necessary.  In any case, install WP in the new site whether local or on-line.
  2. Install and activate both plugins.
  3. Open WP Migrate DB from the Tools menu, but only to get the values for ‘Current address (URL)’ and ‘Current file path’.  Save these values for later use.

B.  Next, get the data from the ‘Old’ (existing) site:

  1. Install and activate both plugins.  Configure BackUpWordPress as you like.
  2. For safety’s sake, run BackUpWordPress from the Tools menu and download the zip file to your computer.  This is a backup of the unchanged site for emergencies, so be sure to include the database in this backup.
  3. Update WP and all plugins to the latest working version.  This step is not absolutely necessary, but this is a good time to get everything current.
  4. Update July, 2014.  Some security plugins and cache plugins have been found to interfere with later steps, so it is a good idea to deactivate them now.
  5. Run BackUpWordPress again and download the zip file to your computer.  It is not necessary to back up the database during this step.
  6. Run WP Migrate DB from the Tools menu.  Use the values you saved in step A-3 above for ‘New address (URL)’ and ‘New file path’.  Save the output file to your computer.

C.  Now load the data into the New site:

  1. Unzip the Old site backup file that was created in Step B5.
  2. Edit wp-config.php and change the ‘DB_NAME’, ‘DB_USER’, ‘DB_PASSWORD’, and ‘DB_HOST’ to the values for the New site.  You can get these values from the wp-config.php file of the New site before you upload the Old site data.
  3. Note that the .htaccess file can contain rules that reference the Old site.  Any such references must either be removed or rewritten to reflect the New site.  One approach is to save a copy of the file from the Old site and then delete it from the upload.  Then add parts back in as needed.It is safe to remove lines between ‘# BEGIN WordPress’ and ‘# END WordPress’ because WP will recreate these lines, although you may have to assign Permalinks back to default and then back to the current assignment to trigger this.
  4. Use ftp to copy the files to the New site, overwriting the initial installation. If the WP version is the same for both sites, you can delete the wp-admin and wp-include folders from the backup to shorten the upload time. I always leave them in in case I overlooked an update.
  5. Use phpMyAdmin to import the database contents file produced by WP Migrate DB.
  6. If you have access errors, try going to Admin->Settings->Permalinks and just clicking ‘Save Changes’.  No need to actually change anything.  If you still have problems, check that you used the correct URLs when you exported the database.
  7. Reactivate any plugins that you deactivated in Step B4.

If Lady Luck is smiling, you should now have an operating copy of the site!  Your login credentials should be the same as on the Old site.

38 Responses to Migrating A WordPress Site – Step By Step

  • I will be moving a web site to a different host and your guide is just what I needed.
    I understand the 2 plugins needed to effect the migration. My question is – after getting the basic WP running on the new site do I need to install all of the plugins I have on the ” old” web site onto the new site, or do they get installed thru the steps in section C ?

    • Mac McDonald says:

      Sorry for the late reply – I am not getting emails when a comment is posted.

      You only need to get the basic WP, plus the WP Migrate DB plugin.

  • Chelsea says:

    If I create a new website on WordPress, can I transfer my site to be hosted on an old domain without creating “new domain”? since age of domain is important for ranking, etc, and to keep internal and external links the same.

    • Mac McDonald says:

      Sorry for the delay in responding. I am not getting emails for new comments.

      I am not sure exactly what you are asking. Can you please give me an example?

  • Irina says:

    I have a problem despite completing all steps as instructed. When I write the address url for the new site ( instead of opening the dashboard i get a download of a file. It is the file that is supposed to open but instead it gets downloaded.

    Could this be because I am using a portable wordpress installation – Instant WordPress?

  • Hi

    Seem to have managed the migration however the internal pages still show the old domain.

    if I type http://siriusfp.co.uk/ that displays correctly but if I then go to any other page ie About the address reverts to http://financialservicesstaffordshire.co.uk/about/

    The admin is also http://financialservicesstaffordshire.co.uk/

    Can you let me know what I might have missed?

    I want to re-direct financial services to Sirius (initially the sirius domain re-directed to financial services) but don’t want to cause a loop.

    hope that makes sense?



    • Mac McDonald says:

      Check the .htaccess file to see if it has any redirects for the URLs in question. If in doubt, rename the .htaccess file to .htaccess-hold and see if that changes anything. If it does, follow step C-4 to rebuild the file without the offending rules.

      • Hi

        Thanks for coming back to me

        I don’t appear to have a .htaccess file.. could this be the issue?


        • Hi

          I have uploaded the files again including .htaccess but it hasn’t changed anything. Pages still revert to financialservices.co.uk



          • Mac McDonald says:

            Did you export the database again using WP Migrate DB and filling in both the new URL and new path? You should not need to upload all the files again, only the database.

            Are you running on Linux/Apache servers? These instructions have only been tested on Linux, not any others.

          • I’m now unable to access the admin for either site 🙁

          • Hi Mac

            I’ve been able to access the admin for the financial services site but now the Sirius admin simply redirects to the financial services admin aaarrgghh!! This is a nightmare lol. Yes it’s Linux

  • Jacquelyn says:

    I just want to make sure I understand the process correctly for my situation where my “new site” is on my localhost and the “old site” in live on the web. I am confused with Step C.4: so I am supposed to upload the backup of the old/existing site to my new site on the local host and migrate the database from the new site to the old/existing site? That seems backwards to me. :-\

    • Mac McDonald says:

      Step C4 says to use ftp to copy the files from the old site onto the new site. Step C5 says to import the database contents into the new site – the contents that you created with the Migrate plugin.

      • Jacquelyn says:

        Okay…it seems to me then that for steps C.4 & C.5 that the “new site” is my existing site on a third party web host server and the “old site” is the new site I created on my localhost; otherwise I am copying files from my existing site on a third party web host server (“old site”) to the new site I created on my local host (“new site”). My situation: I have a WP website hosted on a third party server that I decided to “remodel.” I created my “new site” on my laptop (localhost) and now want to replace the existing site with the new one I created.

        • Mac McDonald says:

          Perhaps it would be clearer to say the ‘old site’ is the ‘source site’, the site you are moving the data from.

          The ‘new site’ is the ‘target site’, the site you are moving the data to.

          You always move data from the old site to the new site, never the other way around.

  • Marissa says:

    I am stuck on part C #1

    I have gotten to that point but when I unzip my old site backup, there is only one file (.sql) inside the folder and I am unable to open it.

    I know this is not right as I don’t see wp-config.php… or anything else for that matter…


  • Velanche says:

    I have tried following the directions about half a dozen times.

    When I go to localhost:8888, I get a white page, but I see that the site title exists when I hover the mouse cursor over the browser tab for the page.

    I then tried doing an end run by typing at localhost:8888/wp-login.php to get the login screen for WP. After attempting to authenticate, the base URL changes from localhost to velanche.com, and I get this:

    Error 403

    We’re sorry, but we could not fulfill your request for /wordpress/wp-login.php on this server.

    You do not have permission to access this server. Data may not be posted from offsite forms.

    Your technical support key is: c7bb-958b-cd36-1abb

    You can use this key to fix this problem yourself.

    If you are unable to fix the problem yourself, please contact dj at velanche.com and be sure to provide the technical support key shown above.

    I know that I’m close, but not sure how to get around this issue. I’d appreciate any guidance you can offer; thanks!

  • Mags Layton says:

    Happy happy joy joy! You are a genius – thank you so much, been struggling with this for a day.

  • Raj Choudhury says:

    Mac you saved my life and sanity.
    Thank you for this guide
    Amazing stuff, book-marked forever

  • Phil says:

    Thanks for these instructions. The only issue I had were 404 errors. This was fixed by temporarily changing the Permalinks (Settings > Permalinks) to default, then back to what it was.

  • Tom Murphy says:

    I was having lots of problems getting my live site downloaded and then imported to my localhost… but thanks to Mac… both in an online forum.. and even more so via Skype, I was successful! He helped me work through several “issues” that were unique to my site and helped me immensely. I am truly grateful for his help and his patience with me, a relative newby.

    I am now able to visit my site on http://localhost/pbgpf and it renders perfectly, including all of the internal hyperlinks!

    Thanks again Mac!


  • I followed your instructions and I can now visit my site on http://localhost/mysitename and it renders perfectly, but none of the internal hyperlinks work. They all direct me to the XAMPP 404 page at http://localhost/xampp/. Is there some other configuration change I need to make (such as a .htaccess file somewhere)? Thanks.


  • Dan says:


    Have you ever seen or tried this: http://www.halty.net/website_mover_0.2.zip
    Claims to be compatible with wordpress but I am afraid to try it on my website


    • Mac McDonald says:

      I have not used that script. In a very quick look I did not see where it handles embedded absolute file upload paths, but I could have just overlooked it.

      My best advice would be to back up thoroughly before using it and use on a couple of test sites first.

      • Dan says:

        Thank you!

        Apparently my webhost has a backup button which also saves the database, so i will be trying this, hope nothing horrible happens. Really do not want to mess things up.

  • Chris Cummings says:

    Thanks for this, it worked!

Leave a Reply

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