Migrate WordPress site to localhost

How to Move a WordPress Site Between Localhost and Live

· · 23 min read ·
Written By: author avatar Joella Dunn
author avatar Joella Dunn
Joella is a writer with years of experience in WordPress. At Duplicator, she specializes in site maintenance — from basic backups to large-scale migrations. Her ultimate goal is to make sure your WordPress website is safe and ready for growth.
·
Reviewed By: reviewer avatar John Turner
reviewer avatar John Turner
John Turner is the President of Duplicator. He has over 20+ years of business and development experience and his plugins have been downloaded over 25 million times.

You want to revamp your website’s design, test out some new plugins, or experiment with custom code. How do you do this without breaking your live site?

Many developers use local WordPress hosts to solve this problem.

Moving your live WordPress site to a local host opens up a world of possibilities. It’s like having a sandbox where you can play with your website without any consequences.

Of course, the trip usually runs both ways. Once you’ve finished building or fixing something locally, you need to get it onto a live server where people can see it.

In this tutorial, I’ll show you both directions: how to pull a copy of your live website down to a local host and how to push a local site up to a live server.

Here are the key takeaways:

  • Local hosting allows you to safely test updates, new designs, and custom code without risking any downtime on your live website.
  • Working locally completely removes server response latency and allows you to work from anywhere, even without an internet connection.
  • Build a local environment with free tools: You can quickly set up a local server on your computer using software like LocalWP, MAMP, WAMP, or XAMPP.
  • A reliable migration plugin like Duplicator Pro lets you bundle an entire site into a single, easy-to-move backup archive, in either direction.
  • Going live to local: drag and drop your backup into a LocalWP installation, or upload the files and launch the installer script on your local server.
  • Going local to live: you’ll also need hosting, a domain, and a new database, and you’ll need to replace your localhost URLs during the install.

Quick Summary: How to Move a WordPress Site Between Local and Live

Live site → local host:

1. Back up your live site.
First, use a backup plugin like Duplicator to back up your entire live website. You’ll get backup files that will help you import your content into the local site.
2. Build a local website.
You can use local development software like LocalWP, MAMP, or WAMP to build a local WordPress site.
3. Create a database for the local site.
Open your local host’s phpMyAdmin dashboard and create a new database for the local site.
4. Import the backup into the local site.
If you already installed WordPress on the local site, drag and drop the live site’s backup into Duplicator’s Import page. You can also just upload the backup archive and installer files to the local server and launch the installer.

Local site → live server:

1. Back up the local site.
Install Duplicator Pro on the local site and back it up. Download the archive file.
2. Set up the live WordPress site.
You’ll need a web host, a domain name, and a WordPress installation on the live server.
3. Create a new database on the live server.
Create a MySQL database, add a user, and give that user full privileges on the database.
4. Import the local backup into the live site.
Drag and drop the local backup into Duplicator’s Import page, then use the Advanced installer mode to replace your localhost URLs with the live ones.

The tool used in this tutorial is Duplicator. It creates a complete backup of your site in one click, then lets you import it into any environment, local or live! Download Duplicator Free →

Table of Contents

Can You Locally Host a WordPress Site?

Using software like XAMPP, MAMP, WAMP, or LocalWP, you can set up a local server environment on your computer. This will install WordPress and run it locally, allowing you to develop and test your website without needing an internet connection or a live server.

Why Locally Host Your WordPress Site?

Whether you’re a developer, designer, or just want to make a few changes to your website, it’s a good idea to build a locally hosted site. Essentially, this involves creating a copy of your live WordPress site and hosting it on a local server on your computer.

This gives you an exact copy of your website to mess around with while your live site remains unchanged.

You can edit your WordPress theme, update plugins, and add new content all without affecting the functionality of your actual website.

Let’s talk about the main benefits of having a local WordPress site.

Build an Isolated Testing Environment

With a local host, you’ll have an independent testing environment. Here, you can freely experiment without impacting the live site.

This allows you to test new themes, plugins, and code changes without the risk of breaking anything on the production website. You can also push changes without downtime, so you won’t harm your SEO. 

Start Learning WordPress

If you’re new to development or design, you can create a local site to build your skills. You’ll be free to learn coding on an offline, free website.

I only started becoming familiar with WordPress a few years ago. LocalWP is my go-to local environment for creating sandbox sites, doing whatever I want, and learning what works. It’s super easy!

Offline Availability

Local hosting allows you to work on your WordPress site even without an internet connection. This is useful when you are traveling or in situations when a stable internet connection is not readily available. You can continue to develop, design, and test your website regardless of your internet access.

Faster Development

Hosting WordPress locally gets rid of the dependency on internet connectivity and server response times. This results in a faster workflow, allowing you to make changes, test them, and see immediate results. 

Confidentiality and Privacy

Local hosting ensures that your work remains confidential and private. You can work on sensitive projects without the risk of exposing them to the public. This is especially important when working on your clients’ websites.

Cost Savings

If you don’t have a live WordPress website, you can create a local site before paying for web hosting services, saving you money in the long run. You can build your first website without any extra costs. This might benefit individuals or small businesses on a tight budget.

How to Move a Live WordPress Site to a Local Host

Now that you know the benefits of hosting your WordPress site locally, I’ll walk you through the process of moving your data to a local server!

Here are the key steps to move a live WordPress site to a localhost:

  • Install a reliable migration plugin like Duplicator Pro for easy transfers
  • Create a complete backup of your live site
  • Set up a local development environment
  • Create a new database for the local site
  • Import your backup files to complete the migration

I’ll show you the best export method to move your site to a local server. However, some web hosts (like Bluehost) allow you to set up a staging site on your live server.

For more details, check out my tutorial on how to create a WordPress staging site!

Step 1: Install a WordPress Migration Plugin

If you want to start testing site changes in a local environment, you’ll want to migrate an exact copy of your data to a local server. Although this sounds like a difficult task, Duplicator simplifies the process. 

Duplicator is the best WordPress backup and migration plugin. It can bundle your entire live website into a single zip file.

This allows you to easily transfer all of your WordPress files, plugins, themes, and database tables to a new location.

Duplicator Pro plugin

Here are some more useful features included in Duplicator Pro:

  • Manual and automatic backups
  • One-click staging sites
  • Cloud backup storage to Duplicator Cloud, Google Drive, Amazon S3, and more
  • Supports large sites and Multisite networks
  • Disaster recovery points for quick site restoration
  • One-click restores
  • One-click remote restores
  • Drag-and-drop imports
  • Empty site support
  • Email notifications for timeouts
  • WP Media Cleanup and DB Optimizer with the Pro and Elite plans, plus Activity Log with Elite

First, select a subscription for Duplicator Pro. There is a free version of the plugin, but a premium plan supports drag-and-drop migrations. This helps you quickly move changes to and from your production site. 

See how Rock Lobster Webdesign uses Duplicator Pro to migrate client sites to testing environments!

After your purchase, copy your license key. Then, install and activate Duplicator Pro on your live WordPress site.

Before you start using Duplicator, you’ll need to activate your license. Go to Duplicator Pro » Settings » General.

Activate Duplicator license key

Paste your license key and hit Activate. Then, feel free to continue to the next step!

Step 2: Back Up Your Live Site

Duplicator allows you to duplicate your entire website. To create this copy, you’ll need to create a backup. This can then be easily transferred to a local host.

To get started, navigate to Duplicator Pro » Backups » Add New.

Add new backup with Duplicator

Give the backup a name and choose Local for the storage location.

Duplicator backup first step

If you want to move all of your data, select Full Site. However, you can also exclude certain site files or only back up your WordPress database instead.

Duplicator's backup presets

Then, Duplicator will scan your live website. You’ll see notices if anything needs your attention.

Duplicator backup scan

Hit Create Backup. Once Duplicator automatically builds a copy of your website, you’ll see it on the Backups page.

Download backup files

Download both the archive and installer files. 

Need an affordable way to back up your website? Duplicator packages your entire site into a single backup you can import anywhere, and it’s free. Get Duplicator Free →

Step 3: Build a Local Site

Next, you’ll need to set up a local site that’s hosted on your computer. To do this, it’s important to find a local server environment

Here are some effective options:

In this tutorial, I’ll be focusing on LocalWP and MAMP.

Method 1: Building a Local Site Using LocalWP

LocalWP is one of the most popular tools for building local WordPress sites. With just one click, it’ll automatically install WordPress for you.

Unlike other local software, LocalWP is compatible with Mac, Windows, and Linux.

LocalWP website

To start creating your local site, go to the LocalWP website and click on Download For Free. Then, choose your operating system.

Download LocalWP

After you install the app, click on the + icon in the bottom left corner. This will allow you to add a new local site.

Add new LocalWP site

Select Create a new site and continue.

Create new LocalWP site

Name the new local site.

Local site name

If you’re a developer, you can customize the local environment with a specific version of PHP, Apache, and MySQL. To do this, select Custom.

However, Preferred will set up a general WordPress installation for you.

LocalWP preferred local site

Lastly, provide a username, email address, and password for the site.

LocalWP WordPress login

LocalWP will take just a few minutes to set up your new local WordPress site. 

Method 2: Building a Local Site Using MAMP

Many people decide to use MAMP for Mac computers and WAMP for Windows. Either of these options will quickly install WordPress and host it on your local computer.

Since I personally use a Mac, I’ll be using MAMP in this guide.

You’ll need to start by going to the MAMP website and downloading the version that is compatible with your computer.

MAMP website

When you open this file, MAMP will walk you through some installation instructions. If you follow these steps, you’ll see a success message.

MAMP successful installation

Now, open the MAMP app and click on Preferences » Ports. Here, set the Apache Port to 80 and hit OK.

MAMP ports

After this, head over to the Server tab. Under Document root, you can choose a folder to store your local site.

MAMP server settings

By default, this will be Applications » MAMP » htdocs

Step 4: Create a Database

Before you start moving your original files to the local site, you’ll need to create a new database. You can do this in your phpMyAdmin dashboard. Open one of the following links:

http://localhost/phpmyadmin/

http://localhost:8080/phpmyadmin/

Then, click on New. Add a name for your new site’s database and hit Create.

Create new local database

Now you’re free to install your backup on the local site!

Step 5: Install Your Backup Files

To make sure your local site looks and feels exactly the same as your live site, you’ll need to import the backup that you saved earlier. I’ll show you how to do this using both LocalWP and MAMP. 

Method 1: Installing Your Backup Files on LocalWP

If you have WordPress already installed on the local site, you can simply drag and drop your archive file into it.

This is my favorite method! I found it the easiest way to get a local site online when I first started out as a WordPress beginner.

With LocalWP, open the app and select your local site. Along with details about the site, you’ll see a WP Admin button.

LocalWP WP Admin button

Click on this to access your new local environment. If you’re opening it for the first time, you’ll need to sign in. Then, install Duplicator Pro as a plugin.

After activating Duplicator, find the Import Backups page. Here, you can simply drag and drop your saved archive file.

Import a backup with Duplicator

Once the backup is ready to install, continue.

Continue installing backup

Confirm that you want to launch the installer and replace any content currently on the local site.

Launch Duplicator installer

Duplicator will walk you through the installation. First, make sure the Install Type is a Full install single site. Then, accept the terms and notices and hit Next.

Local site Duplicator install

Lastly, confirm the installation.

Install local site confirmation

Your production website will automatically be imported into the local site! When this is finished, use the Admin Login button to start testing your site locally. 

Method 2: Installing Your Backup Files on MAMP

If you created your local site with applications like MAMP or WAMP, WordPress won’t be automatically installed. But don’t worry, Duplicator can import your website into a completely blank local site.

First, find the folder where you installed MAMP. In our case, it was Applications » MAMP » htdocs. Here, create a new folder for your local site.

MAMP local site folder

Copy both the archive file and installer script that you downloaded with Duplicator. Paste them into this folder.

MAMP upload Duplicator package

Now, open a browser window and run the installer.php script. To do this, simply search for this URL:

http://localhost/local-site/installer.php

Remember to replace local-site with the custom name of your folder.

This will open the Duplicator installer. Scroll down to Setup, where you’ll enter your new database information.

MAMP database setup

Enter the new database name. For local sites, the host name is localhost and the user is root. Usually, you can leave the password blank, but this could also be root.

After this, hit Validate to test the database. Review any notices, accept the terms and notices, and continue.

Validate local site install

Just like we did with the LocalWP site, you’ll need to confirm your installation settings.

Install MAMP local site

The Duplicator plugin will then extract the archive file. You’ll see an option to log into the WordPress dashboard for your new local site! 

How to Move a Local WordPress Site to a Live Server

Sooner or later, you’ll want to go the other way. Maybe you built the whole site locally and it’s ready to launch, or you tested a redesign on your local copy and now you need it on the production server.

The process mirrors what you just did, with two differences. You need somewhere for the site to live (hosting, a domain, and a database), and you need to swap every localhost URL for your live one during the install.

Here’s how to move your local site to a live server:

  • Create a complete backup of your local site and download the archive
  • Purchase hosting, register a domain, and install WordPress on the live server
  • Create a MySQL database and user with full privileges
  • Import the backup and run Duplicator’s search and replace during the install

You already installed and licensed Duplicator back in Step 1 of the walkthrough above. If you skipped straight to this section, go back and do that first, then come back here. You’ll need it on the local site.

Step 1: Back Up Your Local Site

The backup process is the same one covered above, just run on the local site instead. Go to Duplicator Pro » Backups » Add New, name the backup, choose Local for storage, and pick the Full Site preset.

If you don’t need everything on the live site, switch to Custom and uncheck your media files, inactive plugins and themes, or core WordPress files. Only do this if you’re certain you won’t miss the data.

When the build finishes, download the archive file. You’ll drop this straight into your live WordPress installation in a moment.

Download backup archive file

If you’re manually uploading your site to an FTP client like FileZilla, you’ll also need to download the installer file. Even if you don’t have WordPress installed already, this installer.php script will unpack the archive file and install your content on the new location. 

Step 2: Set Up Your Live Website

Now it’s time to create your live WordPress website! To do this, you’ll need to find a WordPress hosting provider. 

A web host will give you server space and resources for a live website. It provides the infrastructure, server environment, and technical support to ensure your WordPress site is accessible and performs well. 

One of the best options is Bluehost. This web host is recommended by WordPress because of its affordability and scalability, and its entry plans include a free domain name for the first year.

Bluehost WordPress hosting

Once you sign up for a plan, you can choose a domain name. This will be the main part of your URL that encourages brand awareness and memorability.

Bluehost domain registration

Finish creating your hosting account. After this, Bluehost will automatically install WordPress for you. You can simply sign into your hosting dashboard and click on the Log into WordPress button.

Bluehost WordPress login

This will open your new WordPress dashboard! However, it will be a blank installation, so you’ll need to import your local site to upload your custom data. 

Step 3: Create a New Database

Before you start migrating your local site to the new server, it’s important to create a new WordPress database. Usually, your web host will provide an easy way to do this.

With Bluehost, you can simply find the Databases settings and click on MySQL Databases.

MySQL databases

Under Create New Database, enter a name and hit Create Database.

Create MySQL database

You’ll also need to create a new user and assign it privileges for controlling the database. First, fill out a username and password for the user.

Create MySQL user

Scroll down to the Add User To Database section. Here, select both the new user and the new database.

Add user to database

As a final step, assign all privileges to the user. Keep the database name, username, and password somewhere handy, because the installer will ask for all three.

Step 4: Import Your Local Site

If you decided to migrate your site manually, you’d have to upload your local site’s files to your new site with a File Transfer Protocol (FTP) client. Also, it would be necessary to use phpMyAdmin to import your old database.

However, Duplicator Pro simplifies this process. After you set up your live website, open your WordPress dashboard and install Duplicator. Then, find the Import Backups page.

Import a backup with Duplicator

Drag and drop your saved archive file into the import box. You’ll see some details about the backup once it’s finished uploading.

Continue installing backup

If the live site already has content on it, set a recovery point before you go any further. It takes a few seconds and it’s the difference between an easy undo and a bad afternoon.

Disaster recovery point before migration

Then hit Launch Installer.

Launch Duplicator installer

Now, the Duplicator migration wizard will walk you through the installation. At the top, the Install Type should be a Full install single site. You should also choose the Advanced installer mode.

Advanced Duplicator migration

Under Setup, enter your new database name, username, and password. Then, hit Validate

You’ll need to accept the terms and notices. After you click on Next, confirm the installer settings.

This next part is the one that’s specific to going local to live, and skipping it is what leaves people with a site full of broken images. You need to replace your local site URL with the live one.

On Step 3, add your old localhost URL in the Search field. The new live URL goes next to Replace.

Duplicator search and replace

Duplicator will automatically replace every mention of the old URL in your database. You won’t need to install an extra search and replace plugin.

Next, your local site will be moved to the live server. You can use the Admin Login button to access your new website!

One last thing, and it’s the step people forget. Local sites are usually set to block search engines. On the live site, go to Settings » Reading and make sure Discourage search engines from indexing this site is unchecked. Leave it ticked and your new site won’t be indexed at all.

Frequently Asked Questions (FAQs)

How do I create a local copy of a live WordPress site?

To create a local copy of a live WordPress site, start by installing Duplicator Pro. Then, back up your live website. After you create a local staging site, import the backup. You can do this by uploading the archive and installer files to the server or simply dragging the archive file into the Import page.

How do I publish my local WordPress site on a live server?

You can publish your website on a live server by purchasing a web hosting plan and a domain name. Then, use Duplicator Pro to back up the local site and import it onto the live server. During the install, use the Advanced mode so you can replace your localhost URLs with the live ones. 

How do I move my WordPress site without cPanel?

You can move your WordPress site without cPanel by installing Duplicator Pro. This WordPress plugin allows you to download a backup of your site that bundles its files and database information. Then, you can install Duplicator Pro on a second site and drag and drop your site backup directly into it. 

Can I start a WordPress site without a domain?

Yes, you can create a WordPress site on a local server without needing a domain name or a hosting provider. You’ll first need to choose a local development software like LocalWP, XAMPP, MAMP, or WAMP. These will guide you through the process of installing WordPress. 

What is the difference between staging and live WordPress?

Your live WordPress site is the publicly visible website that search engines and online visitors can see and interact with. A staging site is an identical copy of your live website, but it’s hosted locally or on your server’s subdomain. Your staging site is a private, secure place to make edits to your site without affecting your live content.

How do I transfer my WordPress site to a new host and domain?

You can transfer your WordPress site to a new host or domain name by installing Duplicator Pro and creating a backup of your current site. Then, install Duplicator Pro on the second WordPress installation and drag and drop your archive file to import it.

After the migration, it’s a good idea to update your DNS, inform Google about the change, add redirects, and check for broken links. For more details, see how to move a WordPress website to a new host and how to migrate a WordPress site to a new domain.

How do I manually move a WordPress site between local and live?

The manual route is the same in both directions. Move your site manually by exporting the database as a SQL file in phpMyAdmin, then using a File Manager or FTP client like FileZilla to copy everything in the public_html folder (or your local site folder, if you’re going the other way).

On the destination, create a database, import the SQL file through the Import tab in phpMyAdmin, and copy the files into place.

Then you need to search and replace every URL in the database. Go to the SQL tab in phpMyAdmin and run these queries, swapping in your own URLs.

Going live to local:

UPDATE wp_options SET option_value = replace(option_value, 'https://www.example.com', 'http://localhost/local-site') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = replace(post_content, 'https://www.example.com', 'http://localhost/local-site');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'https://www.example.com', 'http://localhost/local-site');

Going local to live:

UPDATE wp_options SET option_value = replace(option_value, 'http://localhost/local-site', 'https://www.example.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = replace(post_content, 'http://localhost/local-site', 'https://www.example.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://localhost/local-site', 'https://www.example.com');

Be sure to use HTTPS if your live site has an SSL certificate. Then hit the Go button. 

Lastly, update the wp-config.php file on the destination. Open it in a text editor and update these values to match the database you just created:

/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** MySQL database username */
define( 'DB_USER', 'username_here' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );

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

If your permalinks stop working after the move, go to Settings » Permalinks and click Save Changes without editing anything. That flushes the rewrite rules and usually fixes it.

How do I copy a staging site to a live site?

To copy a staging site to a live site, install Duplicator Pro on the staging site. Create a full backup of the staging site. On the live site, upload the backup to Duplicator’s Import page. If your staging site is on a subdomain rather than a local server, see our guide on pushing a staging site to live.

Conclusion

You can now move a WordPress site in either direction: pull your live site down to a local host for safe testing, and push your local work back up to a live server when it’s ready.

While you’re here, you may like these extra WordPress tips and tricks:

Are you ready to move your site in either direction? Download Duplicator Pro to migrate between your local computer and your live server in a few clicks!

author avatar
Joella Dunn Content Writer
Joella is a writer with years of experience in WordPress. At Duplicator, she specializes in site maintenance — from basic backups to large-scale migrations. Her ultimate goal is to make sure your WordPress website is safe and ready for growth.
Our content is reader-supported. If you click on certain links we may receive a commission.

Don't Let Another Day Pass Unprotected

Every hour without proper WordPress backups puts your site at risk • Every delayed WordPress migration costs you performance and growth

Get Duplicator Now
Duplicator Plugin

Wait! Don't miss your
exclusive deal!

As a customer, you get 60% OFF

Try Duplicator free on your site — see why 1.5M+ WordPress pros trust us. But don't wait — this exclusive 60% discount is only available for a limited time.

or
Get 60% Off Duplicator Pro Now →