How to Transfer WordPress Site from Live Server to Localhost

Do you want to transfer your WordPress site from live server to localhost? Then this post will help you out.

Installing your WordPress website on localhost gives you the opportunity to experiment on your website without causing any issues to the live site. Even if you want to update your website, it is best to do it in localhost first. After you’re done with the updates, you can upload your WordPress website back to the live server.

There are a couple of ways through which you can bring your WordPress site from live server to localhost. In this video, we are going to discuss 2 methods. Let’s get started.

Why would you move a WordPress site from live server to localhost?

First, let’s answer the most basic question. Why would you want to move your WordPress site from live server to localhost in the first place? Well, the answer is very simple and you know it as well! If you want to update your website or add certain features to it, it is a good idea to do it on your localhost.

If you have a WordPress website, you may naturally want to update the design of your website. You might also want to add new features to your WordPress website. For that, you have to use new themes and plugins. But trying out new themes and plugins on a live website might be dangerous especially if the website has a high volume of traffic. If something goes wrong, your site might break and your users might face difficulty.

To avoid complications like these, many WordPress developers transfer their website from live server to localhost. In the localhost site, you can test out new themes, and plugins and perform other experiments. Once you ensure everything is working smoothly, then you can transfer your WordPress site from localhost to live server.

It is always a good practice to develop your WordPress website on localhost and then transfer your website to a live server once your development is complete. Although you can test your website with dummy data, the actual data in your live server gives you a better visual representation.

Get Latest Post Notifications!

Subscribe to our newsletter

Before You Move Your WordPress to Localhost

Before you begin your transfer process, there are a couple of things you need to do. First off, make sure you do a backup of your WordPress website. There are some great WordPress backup plugins you can use to quickly make backups of your website.

Secondly, you need to install a local server environment on your computer. For example, if you are using Windows, then you can use XAMPP to set up your WordPress locally. You can also use MAMP and WAMP for windows. For Mac, MAMP is a popular choice. 

We have a video tutorial on how to install WordPress on Localhost using XAMPP.  You can check that out, if you prefer using MAMP, we also have a video on how to install WordPress on locahost using MAMP.

After you install a local server environment, you have to create a new database. Simply visit


If you can’t visit the link, then try just entering “localhost” on your URL bar. From there, you can open your phpmyadmin. Once you open up your phpMyAdmin, you can create a database from here.

creating database from phpmyadmin

This database will be useful when you unpack your WordPress website from your live serve. After doing all of these, you are now ready to move your WordPress site from live server to localhost.

How to Bring WordPress Site From Live Server to Localhost

Once you have completed the tasks mentioned above, you can proceed to move your WordPress site from live server to localhost. Let’s summarize what you need to do one more time before we proceed:

  • Make a backup of your website
  • Install a localhost environment (For example: XAMPP, WAMP, MAMP, etc.)
  • Create a database

With all that taken care of we may now move on with the transfer. There are a couple of methods through which you can transfer your live site to localhost, we are mentioning 2 easy methods.

Method 1: Moving WordPress site from live server to localhost using a plugin

Using a plugin you can easily transfer your site from live server to localhost. This is actually the easiest and quickest method of all.

There are a few plugins you can use to do this, but we are using the Duplicator plugin for this purpose. From your WordPress dashboard, go to Plugins > Add New. Then on the search bar type “Duplicator” without quotations.

installing duplicator plugin

The plugin has been developed by Snap Creek and has over 1 million active installations. Install and activate the plugin. As soon as you activate the plugin it will add a new menu item in your WordPress admin sidebar.

After activating the plugin, click on Duplicator and it will take you to the packages screen. Since this is the first time you installed the plugin, there will be no packages. To create a new package click on the “Create Package” button.

creating new package in duplicator

The Duplicator plugin will then launch the package wizard, which has 3 steps. The first step is the setup, the second one is the scan and the final step is the build step.

duplicator package setup

Click on the next button to move on to the next step. In the 2nd step the wizard will scan your website and show you the summary of the scan. If everything goes well, you can move on to the next step which is the build.

duplicator package scanning

Once the scanning is complete, you can then click on the ‘Build’ button and your WordPress site will be packaged and ready to download.

downloading duplicator packages

After the build is complete, you’ll see 2 files, the installer, and the archive. You’ll need both files. So download both files. Now you are ready to install your WordPress website on your localhost.

First off, create a new folder in your local server’s web-root directory. This is the folder where your local server stores all the websites. For example, if you’re using XAMPP or MAMP, the default directory is C:/xampp/htdocs/ (your website folder). Again if you’re using WAMP, then the default directory is C:/wamp/www/ (your website folder).

accessing htdocs in xmapp

While inside this folder (htdocs or www) you can create multiple folders for multiple websites. We are using XAMPP for this demonstration, so we are going to create a new folder inside the htdocs folder. After you’ve created that folder, open it and paste both the installer script as well as the zipped folder.

pasting duplicator packages in localhost drive

Great, now you have both the files and can run the installation. To do that, you need to open the installer script file (the installer.php file) on your web browser. For example, we’ve kept both files in a folder named mywordpresssite. Therefore on the browser, we have to type localhost/mywordpresssite/installer.php

After you enter the installer.php location on your URL bar, you should see a similar Duplicator installation script like the following:

launching duplicator's installer.php script

This will launch the Duplicator Deployment program which will unpack or install your WordPress website locally. The deployment works in 2 main steps. First, you have to connect to a database. Now we need the database that we created earlier. 

In the setup section of the deployment stage, you have to connect your database. From actions, you can select ‘Empty Database’ and the hostname is always localhost. Then for the Database name, put in the name of the database that you’ve created. The user name will be root and for local server installations, there isn’t a password set in most cases. So you can leave that empty.

At the bottom of the page, you’ll find a button called ‘Validate’. Click on this button to validate your WordPress installation.

validating setup in duplicator

If everything goes ok, you’ll see a small ‘pass’ tag on the validation header. This means that your WordPress localhost installation is ready.

duplicator validation results

There’s a checkbox below, click on the checkbox and then click on the next button. It will prompt a confirmation message. Take a look at the summary and click on ok to begin your WordPress installation. It will take a few seconds (depending on the size of your website) and if everything goes ok, then you’ll see a success screen similar to the screenshot below:

testing site after duplicator finishes transfer

Now click on the Admin login and log into your WordPress website with the same username and password that you used in the live server. As soon as you log into your new WordPress website you’ll see the Duplicator menu item selected and it will display the message “This site has been successfully migrated!”.

Another thing that you might need to do is update your localhost site’s URLs. Although you might not face any problems after you move your WordPress site from live server to localhost using the Duplicator plugin. But for some static pages, the URLs might not change. For example, if you hyperlink other posts inside another post.

To update the URLs, go to localhost/phpmyadmin then select the database of the website that you just transferred. Then select SQL from the top bar and paste in the following codes:

Note: Ensure that you replace the “” with your live site’s URL and http://localhost/mywordpresssite with the local server URL of your site.

UPDATE wp_options SET option_value = replace(option_value, '', 'http://localhost/mywordpresssite') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, '', 'http://localhost/mywordpresssite');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'','http://localhost/mywordpresssite');

This query will replace references to your live site’s URL from your database and replace it with your localhost URL. We’ve also discussed this on the 2nd method or the manual process. There’s also a plugin you can use to find and replace the URLs. It’s called the Better Find and Replace

And that is how you can transfer your WordPress site from the live server to localhost using the Duplicator plugin.

Method 2: Moving WordPress site from live server to localhost manually

If you don’t want to use a plugin to transfer your WordPress site, or if the plugin is not working for you, there’s also a manual approach. Let’s go through the steps one by one.

Step 1: Export your live site’s database

The first thing that you need to do is export the database of your live site. In order to do that, log into your cPanel and then locate the ‘Database’ section. Find the phpMyAdmin and open it up.

phpmyadmin in cPanel

After you open your phpMyAdmin, select the database of the site that you want to export. Then click on the export button on the top bar.

exporting database in phpmyadmin

phpMyAdmin might ask you if you want a quick export or a custom export. You can choose the quick method because it’s much faster. But if you’ve used some plugins that you don’t use now, we recommend selecting the custom export

This is because sometimes WordPress plugins can create their own tables in your WordPress database. If you’re not using that plugin anymore then you don’t need those tables. So the custom export method allows you to exclude those unnecessary tables.

But we are not using any extra plugins, so we’ve selected the quick export method. Once you’re done, click on the ‘Go’ button to export your database to your computer.

selecting quick import from live server

Step 2: Download your WordPress files

Now we need to download all of our live WordPress site files. To do that you need to access your WordPress files first. You can either connect to your WordPress site using an FTP client or you can use the File Manager in your cPanel. We will be doing the later.

accessing file manager from cPanel

First off, if you haven’t logged out of your cPanel, then that’s great. Simply locate the files section and select File Manager. Then locate the public_html directory which generally contains your WordPress files. If you’ve created a separate sub-directory for your website, then open that folder.

public_html file in file manager

After you’ve opened up the folder, select all the files and folders in this folder and download those to your computer.

Step 3: Import your live server’s WordPress files and database to your localhost

Create a folder on your local server where you want to put your WordPress files. If you’re using XAMPP, then create a folder inside the htdocs folder. The default location is C:\xampp\htdocs. If you’re using WAMP then the default location is C:\wamp\www. Finally, if you’re using MAMP then the default location is C:\MAMP\htdocs.

If you’ve downloaded your WordPress files in a zip folder, then copy the zip file and paste it into the new localhost directory and unzip all the files and folders in the new location. For example, you should paste it in C:\xampp\htdocs\wp-site if you’re using xampp.

xampp localhost directory

Now that all your files are in the localhost folder, you have to import your database now. To do that, open your localhost phpMyAdmin by visiting the following link:


After opening up phpMyAdmin, click on the ‘Import’ button from the top and click on the ‘Choose File’ button. Then select the SQL file that you downloaded from your live server.

importing sql database

Click on the ‘Go’ button at the bottom right corner of the screen to start importing your database. phpMyAdmin will now unzip and import your database.

Now that your database is imported, you need to update your site’s URLs inside your WordPress database. To do that, you can run an SQL query in phpMyAdmin. Select your local site’s database and then click on ‘SQL’ on the top bar.

sql script to replace urls

Now copy and paste the following code into your phpMyAdmin SQL screen.

Note: Ensure that you replace the “” with your live site’s URL and http://localhost/mywordpresssite with the local server URL of your site.

UPDATE wp_options SET option_value = replace(option_value, '', 'http://localhost/mywordpresssite') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, '', 'http://localhost/mywordpresssite');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'','http://localhost/mywordpresssite');

This query will replace references to your live site’s URL from your database and replace it with your localhost URL.

Step 4: Update your wp-config.php

This is the final step. You have to update your wp-config.php file which consists of WordPress settings and configuration of how to connect to your WordPress database. The wp-config.php file is located in the folder where you installed WordPress. Use any text editor or notepad to open the wp-config.php file.

Now put in the database name that you created in your localhost phpMyAdmin. Then put in your local MySQL username, by default it is root. After that, if you’ve set a password for the MySQL user, then use that password, if not, leave it empty. Once you’re done save the file and then close it.

/** 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');

That’s it! You have manually transferred your WordPress site from the live server to localhost. You can now open your website on localhost by visiting the following URL:


Replace the ‘mywordpresssite’ with the name of the folder where you pasted your WordPress live site’s files.

👉 Video: How to Move Live WordPress Site to Localhost


Transferring your WordPress website from a live server to localhost is a very common way of WordPress web development. That is how professionals update their WordPress websites. Although using a plugin is the easiest method of transferring the site from live server to localhost, the manual process isn’t that complicated.

If the process seems complicated, don’t worry, once you do it a couple of times, you’ll become a pro! If you’ve any questions and if there’s any error you found in this article, please let us know in the comments section below.

We hope this article was helpful and you’ve learned something new. Please check out the WPGIZ YouTube channel for more interesting and informative tutorials on WordPress.

Disclaimer: This post may contain affiliate links and we may receive a small commission if you purchase something by following them. However, we recommend services/products that we believe good to serve your purpose.

Staff Author

Staff Author

A team of WordPress enthusiasts led by Arafat Bin Sultan, a seasoned professional with over a decade of experience in tech blogging, content marketing, and video creation.

Articles: 242

Leave a Reply

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