Your WordPress website on a localhost

Welcome to this guide on how to create a copy of your WordPress website on a localhost.

This tutorial will take you through the steps of downloading and installing XAMPP, creating a subfolder for your website, copying your website’s files and database, and updating the URLs in the database.

By the end of this guide, you will have a functional copy of your website running on your localhost, which you can use for testing and development purposes. Keep reading to learn more.

Why should I create a local version of my website?

Having a copy of your website on a localhost can be extremely beneficial for a variety of reasons.

For example, it allows you to test and make changes to your website without affecting the live version. This can be especially useful for experimenting with new features or designs, or for troubleshooting any issues that may arise.

Additionally, having a local copy of your website can significantly speed up your development workflow, as you can work on it offline and don’t have to rely on internet connectivity.

Furthermore, it also can be a great way to backup your website and have a safe copy if anything happens to the live version.

Overall, creating a copy of your WordPress website on a localhost can be a great way to improve your website development process, and this guide will take you through the steps of doing so in a clear and concise manner.

Step-by-Step Guide

  1. Download XAMPP from here.
  2. Ensure that your Microsoft user account has administrator privileges.
  3. Install XAMPP. It is recommended to install XAMPP outside of the C:\Program Files (x86) directory. A suggested location is the root directory of the C drive (i.e., during the installation you should chose to install XAMPP in C:\xampp). However, if you prefer to install it in C:\Program Files (x86), you will need to disable the User Account Control (UAC) by following steps:
    • Press the windows key.
    • Type UAC.
    • Click Change User Account Control settings in the search results.
    • Drag the slider down to Never notify and click OK.
    • Open up the User Accounts window from the Control Panel. Click on the Turn User Account Control on or off option, and un-check the checkbox.
  4. Create a subfolder in .\htdocs. The subfolder should have the name of your website. For this example we will use the name “website”, i.e. .\htdocs\website
    htdocs is located in your XAMPP istallation folder. If you have installed XAMPP in the C drive root directory, htdocs directory is C:\xampp\htdocs.
  5. Start XAMPP control panel and click on “start” for both Apache and MySQL.
  6. Copy all public_html files in C:\xampp\htdocs\website
  7. Download your website’s database from cPanel:
    • Log in to your cPanel account.
    • Scroll down to the “Databases” section and click on “phpMyAdmin.”
    • In phpMyAdmin, select the database that you wish to download from the left-hand side.
    • Click on the “Export” tab at the top.
    • Select the export method, either “Quick” or “Custom” (if you want more options), for the purpose of this tutorial “Quick” is enough.
    • Select the format in which you want to export the database (you should choose SQL).
    • Click on the “Go” button to start the export process.
    • Once the export process is complete, the browser will prompt you to save the exported file.
  8. Compress the database in bzip2 format.
  9. Create a new database in XAMPP’s phpMyAdmin (this should have the same name of the database you have downloaded). You can access XAMPP’s phpMyAdmin by typing https://localhost/phpmyadmin/ in your browser or by clicking on MySQL “Admin” button in the XAMPP control panel.
  10. Upload the compressed database file to the newly created database.
  11. Run the following code in SQL to update the URLs in the database:
  12. UPDATE wp_options SET option_value = 'https://localhost/website' WHERE option_name = 'siteurl' OR option_name = 'home';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '', 'https://localhost/website');
    UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '', 'https://localhost/website');
    UPDATE wp_posts SET guid = REPLACE(guid, '', 'https://localhost/website');

    Make sure to change “” with the url of your website, e.g. “”

  13. In C:\xampp\htdocs\website\wp-config.php, change:
  14. /** Database username */
    define( 'DB_USER', 'a_user' );
    /** Database password */
    define( 'DB_PASSWORD', 'a_passwords' );


    /** Database username */
    define( 'DB_USER', 'root' );
    /** Database password */
    define( 'DB_PASSWORD', '' );
  15. Login to your local version of the website at https://localhost/website/wp-admin.
    User and password are the same as the online version.
  16. To ensure that no plugins are interfering with links, it is recommended to first uninstall all plugins. Then, reinstall them one by one and test for any interference during the installation process. Keep in mind that many of the plugins may not be necessary for the development version of your website.