Move Live WordPress Site to Localhost ?

A WordPress website may have initially been developed on your local development workstation and publish or you may be taking over the support agreement for a WordPress website and want to carry out some additional work. Either way you don’t want to be developing straight on the Live Server.

We’ll explain how you can move your Live WordPress Website to your local software development machine to continue development.

The steps to do this are as follow:


  • Back up and download your existing website
  • Back up and download the mySQL database
  • Restore Live Database locally
  • Run query to change URL in database
  • Restore live site locally
  • Change Live Site URL in Local URL Tables
  • Put Live site files in loclahost folder
  • Edit wp-config.php
  • Test your website


Back up and download your existing website


The vast majority of Web Host use CPanel and this will greatly simplify the process of creating a back up of your website.

Login into CPanel and navigate to File Manager

CPanel File Manager

We usually compress the entire public_html folder or whatever directory your WordPress site has been installed in.

Depending on the size of your WordPress file, you can either download it straight from the CPanel or you can connect to your FTP and download the compressed folder.


Back up and download the mySQL database


Login into your Live Websites phpMyAdmin and Export your your Database

mySQl Export

You may need to change a few settings here, depending on your set up.

Restore Live Database locally

Login in to your local PhpmyAdmin (http://localhost/phpmyadmin) and create a database with the same name as your production.

[thumbnail target=”_self” src=”//”]

Restore Live Database to locally

Navigate to you Import tab and import the database

[thumbnail target=”_self” alt=”Import mySQL Database” src=”//×557.png”]

Change Live Site URL in Local URL Tables

Got to the SQL tab in http://localhost/phpmyadmin and execute the following queries putting your website URL
[pastacode manual=”UPDATE%20wp_options%20SET%20option_value%20%3D%20replace(option_value%2C%20’’%2C%20’http%3A%2F%2Flocalhost’)%20WHERE%20option_name%20%3D%20’home’%20OR%20option_name%20%3D%20’siteurl’%3B%0D%0AUPDATE%20wp_posts%20SET%20post_content%20%3D%20replace(post_content%2C%20’’%2C%20’http%3A%2F%2Flocalhost’)%3B%0D%0AUPDATE%20wp_postmeta%20SET%20meta_value%20%3D%20replace(meta_value%2C’’%2C’http%3A%2F%2Flocalhost’)%3B%0D%0A” provider=”manual” lang=”mysql”/]
[thumbnail target=”_self” src=”//×301.png”]

Put Live site files in localhost folder

Ensure your local host folder is empty
[pastacode manual=”sudo%20rm%20-rf%20%2Fvar%2Fwww%2Fhtml%2F*” provider=”manual” lang=”javascript”/]
move your tar file to this folder
[pastacode manual=”sudo%20cp%20threenine.tar.gz%20%2Fvar%2Fwww%2Fhtml%2Fthreenine.tar.gz” provider=”manual” lang=”javascript”/]
uncompress the file
[pastacode manual=”sudo%20tar%20-xvzf%20%2Fvar%2Fwww%2Fhtml%2Fthreenine.tar.gz” provider=”manual” lang=”javascript”/]
Change persmissions on the folder
[pastacode manual=”sudo%20chown%20-R%20www-data%3Awww-data%20%2Fvar%2Fwww%2F.” provider=”manual” lang=”javascript”/]

Edit wp-config.php

You will need to change the UserName and password for the database in your wp-config.php.  We’ll we’ll use nano tesxt editor to the edit the file.
[pastacode manual=”sudo%20nano%20wp-config.php” provider=”manual” lang=”javascript”/]
change your DB_USER and DB_PASSWORD to your local username and password.

Follow Me