Why would you want to clone a live WordPress site? There are many reasons, perhaps you were testing your upcoming website in a local environment using XAMPP or WAMP and want to make it live. Or maybe you want an exact replica of your live site for backup and development purposes. Whatever the reasons, this article walks you through the process of cloning/copying a WordPress site with ease using cPanel. This article is a companion post to our recent article on How to Install WordPress on Windows Localhost in 8 Easy Steps Using XAMPP.
You can also use plugins like Duplicator to make a clone of your live website. However, you will have to purchase the pro features. The free versions of the cloning plugins have some limitations.
[socialpug_tweet display_tweet=”This guide walks you through the process of how to clone a live #WordPress site to localhost without using any plugin in 5 easy steps.” tweet=”This guide walks you through the process of how to clone a live #WordPress site to localhost without using any plugin in 5 easy steps. #wamp #xampp #cpanel ” ] Why you’d want to clone a Live WordPress Website to Localhost.
Why you’d want to clone a Live WordPress Site to Localhost
The term cloning is different than backing up your website, although a cloned copy can also serve as a backup. The purpose of the backup is to protect against data loss. Typically, backups are restored to the same place they came from. Cloning a website means creating an exact operational copy of an existing website that you can apply on a different location be it your local computer or another host. Cloning can save you a lot of time and decrease the chance of any mistake. It also eliminates the chance of leaving something out.
There are countless times when the ability to clone WordPress sites can come in handy, such as:
- Creating a local version of a live site for backup, testing, and development purposes.
- Move, migrate, and clone a WordPress site to a different domain name with zero downtime.
- Manually backup a WordPress site or parts of a site.
- Bundle up an entire WordPress site for easy reuse or distribution.
- Migrating to a new host.
- Moving changes from a development site to staging or production.
- Using an existing site as a basis for new sites.
What are the prerequisites?
Before we proceed, the things you need:
- Localhost environment setup with XAMPP
- FTP application such as FileZilla to access and retrieve files from your live server.
- FTP or SFTP login credentials to be used with FileZilla.
- Database login credentials
- WordPress login credentials
Clone a Live WordPress Site to Localhost
Here’s an easy guide on how to efficiently clone a WordPress site with ease:
Step #1: Download Site Files Via FTP or SFTP
Depending on the size of the files of the website, this step is probably the longest. Because you have to wait until all the site files are downloaded on your computer.
Open FileZilla and connect to the FTP server using FTP or SFTP login credentials. Once you connect to the host, download all files, and keep them in a folder. For the sake of this article, let’s call this folder sitedev.
Step #2: Export Database from Live Site using phpMyAdmin
First of all, you need to login to your hosting account and access cPanel. Next, click phpMyAdmin from the Databases section.
The phpMyAdmin interface is divided into two panes. Select the database from the left pane. From the right pane, select the Custom radio button under Export method. Enter sitedev_backup in the File name template field.
Now, scroll down to the bottom of the page and click Go and save the sitedev_backup.sql file to a location on your computer.
Step #3: Import Database in Localhost XAMPP Environment
Now, it’s time to import the SQL data that you just saved to the local environment. Open the XAMPP Control Panel and then make sure Apache and MySQL modules are running. Click the Admin button corresponding to the MySQL module to open phpMyAdmin on the local computer.
Click the Admin button corresponding to the MySQL module to open phpMyAdmin. The interface is divided into two panes. On the right pane, make sure you are in the Databases tab and then enter sitedev_db in the Database name field. Now, choose Collation from the drop-down located next to the Database name field. Next, click Create; the database is now ready for the WordPress installation.
Make sure the new database is selected and then choose the Import tab from the right pane of phpMyAdmin and then click the Choose file button and select sitedev_backup.sql file. Now, scroll down and click Go. On successful completion, you will get a message, as shown in the Figure below.
Select the wp_options table and then double-click on the option_value corresponding to the siteurl option_name and change option_value to http://localhost/sitedev. Similarly, repeat the process for the home option_name. Now, copy the sitedev folder that contains downloaded files to /xampp/htdocs folder.
Step #4: Connect Database
Now, we need to connect the database to WordPress. Open the /xampp/htdocs/sitedev/wp-config.php file. In this file, replace:
- define( ‘DB_NAME’, ‘live_site’s_database_name’ ); with define( ‘DB_NAME’, ‘sitedev_db’ );
- define( ‘DB_USER’, ‘live_site’s_username’ ); with define( ‘DB_USER’, ‘root’ );
- define( ‘DB_PASSWORD’, ‘live_site’s_password’ ); with define( ‘DB_PASSWORD’, ” );
Save the file. Now, in your browser, navigate to http://localhost/sitedev. If you have followed all the steps carefully, you will see your website in the browser.
Now, navigate to http://localhost/sitedev/wp-admin and login with your live website’s WordPress credentials to access the dashboard.
Step #5: Troubleshooting
If your browser only shows the home page and for other pages and posts displays the XAMPP dashboard. Here’s how you can fix it:
If you are not worried about the permalink structure, just login to the WordPress dashboard and then navigate to Settings > Permalinks. Now, under Common Settings, select the Plain radio button and then click Save Changes; you would be able to access all pages and posts now. If you want to retain the original permalink structure, see method 2 below.
In the XAMPP control panel, click the Config button corresponding to the Apache module and then choose Apache (httpd.conf) option from the popup menu. Now, find AllowOverride None and change it to AllowOverride All. It ensures that the .htaccess file is not ignored that stores the permalink structure. Save the changes and close the httpd.conf file. Stop and then restart the Apache module.
Login to WordPress dashboard and navigate to Settings > Permalinks and click Save Changes; you should be able to access all pages and posts of your website. If you are still facing the problem, delete the .htaccess file form the website root. In this case, the file will be in the following folder: \xampp\htdocs\sitedev. Now, in Settings > Permalinks page, click Save Changes. The .htaccess file will be created automatically and the website should work as expected.
Another Method for Taking Backup
You might be hosting multiple websites with your hosting plan. You can create a full backup of all your websites files and configuration. To do so, navigate to the cPanel Home and then select Files > Backup.
Next, in the Full Backup section, click the Download a Full Account Backup button. Now, choose a location for the backup. If you want to get notified about the backup completion, enter the email address as well. Click Generate Backup to create the backup.
cPanel also gives you the ability to download partial backups. To do so, navigate to Files > Backup from the cPanel Home and then scroll down to the Partial Backups section. From here, you can download a backup of the home directory, databases, email forwarders, and email filters. The same section also allows you to restore the backup.
If you like this process in the form of a wizard, you can do so by clicking the Backup Wizard option from the Files section of the cPanel home.
Please keep in mind you cannot restore Full Backups through cPanel interface. If you are looking for a one-click restore feature for your WordPress website, you can use VaultPress.
Cloning a live WordPress site without using any plugin may sound complicated, but it can save you a lot of headaches. Fortunately, it only takes five steps to get up and running:
- Download Site Files Via FTP or SFTP
- Export Database from Live Site using phpMyAdmin
- Import Database in Localhost XAMPP Environment
- Connect Database
[socialpug_tweet display_tweet=”This guide walks you through the process of how to clone a live #WordPress site to localhost without using any plugin in 5 easy steps.” tweet=”This guide walks you through the process of how to clone a live #WordPress site to localhost without using any plugin in 5 easy steps. #wamp #xampp #cpanel ” ]
I hope this article helped you learn how to copy or clone a live WordPress site on Windows localhost using the XAMPP development server and cPanel. If you liked this article, please subscribe to our newsletter. You can also connect with us on YouTube, Facebook, Twitter, and Pinterest. If you are a foodie, please check our recipe grid.
Do you have any questions or suggestions about how to clone a live WordPress site using cPanel? Ask away in the comments section below.