Hosting Tutorial & Guide

How to Make a Local Copy of a Live WordPress Site

updated on Oct 13, 2016
How to Make a Local Copy of a Live WordPress Site We have the 6 simple steps below to help you copy a live WordPress site to your local environment for the further development and design, although it may be a risky task for the newcomers with a limited technical knowledge and experience.

Step 1 – Create a Local WordPress Website

To start with, you'd better have a local installation of WordPress to free yourself from many troubles later on. This kind of local site is quite beneficial, and you can achieve your testing and development outcomes without being indexed by Google and other search engines. Since you're satisfied with all changes, you can directly migrate this local WordPress site to a live server.

Thanks to various third-party software in the market, it can take little effort to get a WordPress site up and run it on a local machine. Based on popularity and ease-of-use, it is recommendable to go with this free piece of software named as XAMPP to set up a localhost environment. Note that, the XAMPP software can work well with Windows, Linux and OS X platforms as well.

Create a Local WordPress Website

Step 2 – Access Your Live Site's Files

The next step is to get access to all your live site's files. To do that, you are expected to log into cPanel and navigate to "File Manager" located at this "Files" section. Just click on the "File Manager" icon and you will be prompted to choose the very directory you want to open. Make sure that you would choose this "Web Root" option and check the "Show Hidden Files" box inside this pop-up.

Access File Manager Section

And then, you shall go and find the folder directory where your WordPress has been installed. If you only have one domain without additional sub-domains, then all of your WordPress files are available under this "public_html" directory. As is showed below, there are many sub-directories inside your WordPress installation folder, such as "wp-admin", "wp-content" and "wp-includes", etc.

Enter WordPress Installation Folder

Step 3 – Copy All WordPress Files

Once done, you will need to copy those files on your live WordPress site to a local server. When selecting your files, you'd better not include the files that are irrelevant to WordPress folders. Plus, as the inbuilt .htaccess file is attached with important references to the current WordPress installation, you will need to place this file in the same location where you've copied WordPress files.

Copy All WordPress Files

Having selected all needed files, you can press the "Ctrl" key on your keyboard, and in the meantime, click on the folders that are not being copied so as to avoid duplicates of those files on your local site. After that, just make a hit on the top right option of "Copy" and you will be asked to type in the destination address as above. Remember to click "Copy Files" button to proceed with this process.

Important to Note: Alternatively, you can choose to enter your live site's files via FTP client. And it is also possible to download your current WordPress files to a default "htdocs" folder generated by the XAMPP.

Step 4 – Export WordPress Site's Database

By all accounts, the heart of each WordPress installation is the database that is not included within your downloaded files. Fortunately, you can go directly to the wp-config.php file to find out your database. Now, open this wp-config.php file with "Edit" option and you will know your database name after this 'DB_NAME' configuration code. By the way, you will get to know your database username and password as well.

The Name of Your Database

After that, go back to the cPanel interface again so that you can enter your phpMyAdmin panel from this "Databases" area. Upon entering, you are required to press the "Export" button as is displayed in the following screenshot. Make sure that you will choose this "Custom" export method to display all potential options out there. If done correctly, there will be a set of databases for you to choose from.

Export Your Database

At this place, you only need to export the very database that you find within the wp-config.php file. Just set the rest of the custom settings aside and press the "Go" button to go on. Note that, it will take a while to download the database to your computer.

Step 5 – Import Your Database to a Local Server

And then, it needs to import your website's files to a local machine inside this phpMyAdmin page. To log into your local server's phpMyAdmin, you can open a browser tab and enter http://localhost/. If you're using the recommended XAMPP, you will get a main menu where there is a phpMyAdmin option in the sidebar.

Import Your Database to a Local Server

Once entered, you should select all database files exported from your live site and click the "Import" tab. If you've done, do not forget to press "Go" button to take effect.

Step 6 – Create the Database for Your Local Usage

Now that you have imported all database related files into a local server's phpMyAdmin, you can click the "Database" tab. If nothing goes wrong, your live site's database will be listed as below, and all you need to do is click on the "Check Privileges" link alongside your database.

Check Your Database Privileges

And next, choose the "Add User" option in the following screenshot and you will be asked to fill in certain personal information. Pay attention that, the database username and password can be found after the above-mentioned DB_USER and DB_PASSWORD variables. Replace the 'Host' as 'localhost' and leave the rest of other settings before clicking the "Add User" option.

Add New Database User

Last but not the least, you will have to go back to your live phpMyAdmin and navigate to "Database" tab. Once completed, there will be a full list of table names, and you only need to edit the "siteurl" and "home" fields. Just press the "Edit" button next to each of these fields and change the "option_value" into http://localhost/yourfoldername/.

Edit SiteURL & Home Fields

Till present, you can check whether or not your local WordPress site is up by typing in the same http://localhost/yourfoldername/ in the browser tab. If you happen to use custom permalinks, then you will have to change them into the defaults by going to "Settings" > "Permalinks" from the WordPress dashboard. By the way, you should make sure that the image links in any post/page are changed accordingly.

Change Custom Permalinks

Note for Beginners: In most cases, the phpMyAdmin option is provided by the most popular hosting providers. If you are struggling to cope with it during this copy process, you can seek professional assistance from the web host. In the following table, there are some highly-recommendable hosting companies, all of which are incomparable in technical support.