WordPress

Move a Live WordPress Website to Localhost Server

Written by:

Whether you are are doing testing or creating a new theme, there may be a time in your WordPress life that you will need to move a live WordPress website to a localhost web server. But lucky for you, you can move your WordPress website to a local server with quickly and with ease.

How to Move Life WordPress Website to Localhost Server

  1. Create a full backup of your live WordPress website
  2. Backup your MySQL database using phpMyAdmin
  3. Install a localhost web server
  4. Extract your WordPress website backup on the localhost server
  5. Import your MySQL database on your localhost server
  6. Update the wp-options table in the localhost database
  7. Update your wp-config.php file
  8. Enjoy your WordPress website on your local server

Step 1: Create a full backup of your live WordPress website

Once you are ready to move your WordPress website, you will need to create a full backup of your live WordPress website. You can either use a web based file manager like cPanel. Or use an FTP client. Either works.

Move a Live WordPress Website to Localhost Server - 1. cPanel home - file manager

On cPanel, open the File Manager application. Browse to the directory that your live WordPress website is installed to. For most websites, it will be located at /home/YOUR_USERNAME/public_html. Usually you can just click on the public_html link in the File Manager.

Move a Live WordPress Website to Localhost Server - 2.0. cPanel file manager

Once you find your live WordPress website, click on the “Select All” button then “Compress”.

Move a Live WordPress Website to Localhost Server - 2.1 select all files

This will give you a popup window to create a zip archive of your entire website (aka a full backup of your live WordPress website).

Check the box for “Zip archive”, then click the “Compress Files” button. You should a get a short loading message followed by a success message.

Now from the File Manager, find the zip archive you just created. Usually, the File Manager will give it the same name as one of the files you backed up. Download your WordPress website backup and save it it your computer in a safe place.

Please note: You may need to press the “Reload” button for the website backup to show up.

Move a Live WordPress Website to Localhost Server - 2.2 create a backup of your live wordpress website

Step 2: Backup your MySQL database using phpMyAdmin

Now that you have your WordPress files, like your themes and plugins, you will need to also backup your MySQL database. Without the database, your WordPress website will be pretty darn useless!

Check this out:  Patron Only Blog Posts? Add Patreon to Your WordPress Site!

Inside of cPanel, locate and open the phpMyAdmin program.

Move a Live WordPress Website to Localhost Server - 1. cPanel home - phpMyAdmin

Once phpMyAdmin loads, you will see a list of databases on the left hand side. Select the correct database for your live WordPress website to move to localhost.

Please Note: For most people, there will be only two databases listed. Your live website’s database and the default phpMyAdmin database (information_schema). When you select a WordPress database, you should see lots of tables listed inside like the ones shown below.

Move a Live WordPress Website to Localhost Server - 5. phpMyAdmin home

Create a complete backup of the WordPress database by going to the Export tab. Simply click the “Go” button and your database backup will be downloaded. This can take some time, depending on the size of your database. Save the database backup to the same location as your live website files.

Move a Live WordPress Website to Localhost Server - 6. create a backup of your MySQL database using phpMyAdmin

Step 3: Install a localhost web server

In order to move a live WordPress website to a localhost server, you will need a localhost web server setup. Obviously. I recommend installing the XAMPP server package. You can download it from ApacheFriends.org.

If you need an in depth tutorial on how to install it for WordPress, you can check out my other article on how to install WordPress on a localhost server.

Step 4: Extract your WordPress website backup on the localhost server

With your localhost server up and running, browse over to the localhost website directory. If you use XAMPP like me, it should be located at C:\xampp\htdocs\

Move a Live WordPress Website to Localhost Server - 7. extra backup website files to localhost server

Create a new folder to house your local version of your live WordPress website. I’ll call mine HeyTuts.

Extract your live website backup inside of this folder. Once complete, you should see all the WordPress files directly inside of this folder. If not, then move them to this folder.

Check this out:  WordPress Pingbacks and Trackbacks: Everything you need to know

Now your localhost WordPress website should all be located inside of C:\xampp\htdocs\YOUR_FOLDER_NAME

Step 5: Import your MySQL database on your localhost server

Next, open phpMyAdmin on your localhost server. Usually, you can navigate to http://localhost/phpMyAdmin in your web browser.

When phpMyAdmin loads, you will see a list of all your current databases on the left hand side. If you have a brand new installation of XAMPP, the you should just have the default databases.

Move a Live WordPress Website to Localhost Server - 8. create a new database for your localhost wordpress site

Above the list of databases, click the “New” button.

In the simple form, enter the name of your new database. I recommend naming something simple. Like your website name. I will use the name “heytuts“. When satisfied, click the “Create” button.

Afterwards, phpMyAdmin should auto select the new database for your. If not, then select the database from the left hand side.

Move a Live WordPress Website to Localhost Server - 9. import the MySQL database backup from cPanel

Next, open the Import tab. Under the “File to import” section, browse and select your MySQL database backup from before. Then click the “Go” button at the bottom right. This will import your live website’s database into your localhost server. This can also take some time, so please be patient.

Step 6: Update the wp-options table in the localhost database

With your database successfully imported, we have to manually change some of the database records. Don’t worry. It is super simple.

Locate and open the wp-options table in phpMyAdmin. You must update the “siteurl” and “home” fields. (they should be at the top of the list already).

Move a Live WordPress Website to Localhost Server - 10. update wp-options table

Click on the “Edit” button for each and change the “option_value” for each to be your new localhost website’s address. It should be http://localhost/YOUR_WORDPRESS_FOLDER.

Please note: If you are unsure, you can always navigate to your localhost web sever in the browser. Select the correct folder. Then just copy and paste the link.

Step 7: Update your wp-config.php file

With your new localhost database fully setup and configured, we need to update tell the WordPress configuration file how to connect to our localhost database.

Check this out:  Introduction to phpMyAdmin | What is phpMyAdmin?

Browse over to your localhost website’s folder and find the wp-config.php file. Open the file in your favorite code editor (I like VS Code). You can also use notepad if you don’t have a code editor.

Move a Live WordPress Website to Localhost Server - 11. update the wp-config file

Find the database connection settings in the wp-config.php file. They should be near the top. They will look like the lines highlighted above.

Update each of these settings for your localhost server:

  • DB_NAME – the name of the database you created earlier
  • DB_USER – “root”
  • DB_PASSWORD – your phpMyAdmin account password (see below)
  • DB_HOST – should not be set to “localhost”, if not already

Please note: If you just installed XAMPP and have not configured a secure phpMyAdmin password, then the default password is blank. Like “leave it empty” blank.

Step 8: Enjoy your WordPress website on your local server!

If you completed all the above steps, your website should now be fully functional on your localhost web server. So go test it out!

Navigate to your website by going to http://localhost/YOUR_FOLDER_NAME

Now you have successfully moved your live WordPress website to a localhost server! A great time to start trying new themes, creating custom themes, and testing new plugins. Go live your best WordPress life!

Leave a Reply

%d bloggers like this: