How to clone wordpress site to localhost – Clone wordpress site easily

How to clone wordpress site to localhostYou might hesitate to do some changes to your live wordpress site because you will feel that your site may get ruined after some changes that you make like adding codes and editing files (php, CSS….). For this reason you should have a clone of your live wordpress site in your local computer, so you can make changes and confirm it whether it’s working or not and implement it to your live wordpress site. Let’s see a step by step method on how to clone wordpress site to localhost

How to clone wordpress site to localhost

A few posts back we have made a detailed explanation on how to backup wordpress database and files. Make use of that post and follow the methods to export your wordpress database and files

Things you will need to clone your wordpress site to localhost:

  1. Database of your live wordpress site
  2. WordPress files
  3. Notepad ++ (you can see the download link in this post)
  4. Local server software (XAMPP, WAMP, EasyPHP)

Also make use of this article on How to run your computer as a local server and How to install wordpress on localhost using WAMP.

We hope that you have got all the necessary things mentioned above. Now it’s time to clone your wordpress site to localhost.

How to clone wordpress site to localhost

WordPress file setup in local server:

  1. Copy and paste the wordpress file to your local server  ( c:\wamp\www)
  2. In your wordpress file open wp-config.php using Notepad++ and do as follows. (empty DB_PASSWORD field and change DB_USER field to root also note the DB_NAME)
  3. Now open http://localhost in your browser and you will see your project.
  4. In order to confirm the URL path open your project where it says (error establishing a database connection). Note that URL path, in our case its http://localhost/blogtimenow/.

WordPress database setup in local server

  1. Go to http://localhost/phpmyadmin/ and create a new database as the name you noted in step 2 of wordpress file setup DB_NAME
  2. Now open your database.sql file in Notepad++ and find your live wordpress URL using search options. In our case its http://blogtimenow.com/
  3. Now replace all http://yoursite.com/ to http://localhost/yoursite/ it says 3994 occurrences has replaced (something not exactly).
  4. For additional replacement remove http:// and replace all as follows (yoursite.com to localhost/yoursite) and save your database.sql file.
  5. Now import your database.sql file in phpMyAdmin and click GO.

With No hassles you have cloned your live wordpress site to localhost and now you can start editing your local site.

NOTE: Custom permalink structure will not work for most users as their configuration may vary so set it to default.

TIP: You will have a big sized database to upload and phpMyAdmin has Max file size limit to upload. To change the size limit open php.ini file and find “File Uploads”  and edit upload_max_filesize = 100M.

Easy method to Clone and migrate wordpress site

If you find the above method to be difficult then there is the easy method to clone your wordpress site to localhost. Just install Duplicator plugin and in simple easy steps you can clone your live wordpress site to localhost or migrate to your live servers. Check out the video below on Duplicator plugin that clones live wordpress site to localhost.


If you find this article useful on how to clone wordpress site to localhost then please comment below and share it. Subscribe for weekly updates from Blog Time Now.