Written by on

Moving a WordPress Site to Localhost with BackupBuddy

BackupBuddy makes it easy to move your WordPress sites from one host to another, from one domain to another and from localhost to live site. In this post, we’ll cover moving a WordPress site to localhost with BackupBuddy and ImportBuddy to make changes, and then push the changed site back to live again.

The localhost method may be ideal for those of you that want to make changes, big or small, without having to do so directly on your live site for everyone to see. The localhost method is also great for developing WordPress sites locally and then moving them to live. Let’s get started.

Choosing your Localhost Software

There are many localhost software options, including MAMP Pro, Desktop Server, XAMP and WAMP. Some softwares are designed to only work on a specific OS (Mac or PC), so choose the one you like best and get to know the ins and outs of it.

For the purposes of this example, we’ll be using MAMP Pro for the Mac.


Getting Started: Creating & Downloading a Backup

The first step for moving your site to localhost is getting it there. To accomplish this, we’ll use a BackupBuddy complete backup.

After you’ve installed and activated BackupBuddy on your live WordPress site, you’ll need to create a new complete backup with BackupBuddy. From the WordPress dashboard, visit BackupBuddy > Backup.


From the BackupBuddy Backup page, select to run a Complete Backup.


After the backup completes, select to download the backup file or, if you prefer, send it to BackupBuddy Stash or any other of your remote destinations.


Tip: Enable a Maintenance Mode Plugin

At this point, you may also want to enable some sort of maintenance mode plugin. This will prevent changes being made to your website such as users adding comments, ordering products, submitting posts, etc.

Adding the Backup File Zip & importbuddy.php

Once you’ve downloaded the backup of your site, you’ll want to place the .zip file within a specific directory for your localhost program to access.

For MAMP Pro, this directory is called “htdocs”, and can be found within the MAMP folder, inside Applications.


Next, you’ll want to download ImportBuddy.php file. Navigate to BackupBuddy > Restore / Migrate in your WordPress dashboard. From the Restore / Migrate page, click Download importbuddy.php.

download importbuddy

When you click the download button, a window will pop up asking if you would like to create a new password specifically for ImportBuddy.php. You can set this if you like, or hit cancel to use your default password.

After you download the ImportBuddy.php file, move it into the same folder where you put the backup file in the MAMP “htdocs” folder.

Importing to Site to Localhost

Once you’ve fired up your localhost software, navigate to the importBuddy.php URL within the browser (for example, the location of this file URL could be something like http://localhost:8888/importbuddy.php) depending on your localhost port settings.


From this screen, ImportBuddy will ask for authentication. Input your password and hit the button to continue.


Next you’ll need to select the backup file you want to import. Using MAMP, ImportBuddy will automatically find the file that we put in the htdocs folder.

You can change the directory that ImportBuddy looks, if necessary. If you opted to upload your backup file to Stash, ImportBuddy will be able to pull the backup file from there as well. Moving on to the next step will unzip the backup file, moving all the files into the same folder as the .zip file itself.

Setting Up a Database

During the next step, you’ll need to set up a database for the site. You can use Terminal or Command line to create databases, but most localhost software should have a method to administer MySQL.

In MAMP Pro, you can find this option within the MySQL tab. At the bottom, click through to phpMyAdmin.

Within phpMyAdmin, we can manage databases or create new ones. Go to the Database tab, where you’ll see a list of any of your existing databases. If none exist or you want to create a new one, type the name of the database you wish to create into the text field and hit Create.


Go back to ImportBuddy and add the name of the database you want to use, along with the username and password. If you did not specify a username or password for the database, there may be default settings that you should use depending on the software you’re running. For MAMP Pro, we’ll use “root” for both the username and password.


Before you move on to the next step, make sure to test the database. You always want to test your database before continuing to make sure everything works correctly. This can save you from a lot of wasted time and headaches in the future.


Finishing the Import

When you do move on to the next step, ImportBuddy will begin database migration. After it completes, it will provide a URL to verify that the migration has succeeded. When you click it, it should take you to the root localhost URL, which should appear to be the home page of your site. Finally, move on to the last step to clean and remove all the extra BackupBuddy files and your migration will be complete.


You can now log into WordPress within localhost and change your site in any way you want.

Moving Back to the Live Site

After you’ve made the changes you wanted to make, it’s time to move your site back to the live site. The first thing to do is make a new backup of the modified site. In the same way as you did earlier with the live site, make a backup of the modified version on localhost. You can download it to your machine again, or you may find it easier to simply send it to Stash instead.

Next, make sure you have ImportBuddy.php inside your live WordPress site. If you don’t, you can use your FTP client to upload the file directly into your site’s root directory (public_html).


Now go to yoursiteurl/importbuddy.php to now import the newly modified version to your live site. These steps will be largely the same.

During step 3, within the Advanced Options you will have the ability to delete the database after the import, if you so choose. If you only made some minor adjustments that didn’t require a database you can opt to skip it as well. Lastly, if you forgot the database that you used you can simply create a new one. You won’t lose any data by doing this, as you are importing a full backup file.

It’s important to keep in mind that during the import process back to your live site, your site will be unavailable until the process is complete. Fortunately, ImportBuddy won’t take long to complete, but we still advise doing the import during a time when you suspect there will be the least amount of traffic on your site.

Another Maintenance Method

Most shared hosting will have a preference for displaying HTML files over PHP files. You can use this to your advantage by creating an “index.html” file and putting it in your site’s root directory. Since WordPress does not use HTML files, it will operate as a maintenance mode plugin. This will allow you to do all your importing, changing, etc. and be able to simply delete the HTML file when you’re finished.

Watch the Webinar: Moving a WordPress Site to Localhost with BackupBuddy

To see the process of moving a WordPress site to localhost (and back to live site) in action, here’s the webinar video replay.


Get the Best WordPress Backup Plugin, BackupBuddy

BackupBuddy is the best way to backup (and move) a WordPress site. You’ll love all the options BackupBuddy gives you for safe, offsite storage of your backups, including Amazon S3 and our own remote storage destination, BackupBuddy Stash. With easy site migrations and deployment for developers, BackupBuddy is a must-have plugin for all WordPress site owners.

Get BackupBuddy now



Sale ends Nov. 30! Save 50% OFF our entire library of WordPress tools Get the coupon