How to Manually Clone a WordPress Website.
Why Do You Need to Clone Your Website?
Website cloning is the process of creating an exact duplicate of your website. By using this clone, you can create blueprints, perform updates, test compatibility, and more before implementing the changes on your website.
Every power user of WordPress has access to create the exact copy of your website. Whenever an issue occurs on your live website, you can create a clone and try the fixes in that copy until you get a resolution. So, it is easy to implement the correct resolution on your live website.
CLONE A WORDPRESS WEBSITE MANUALLY
The manual process of cloning your WordPress website includes the following steps:
Compress WordPress Files
First, you need to clone your website is to compress all the files and folders in your public_html directory. For the same, follow the below steps:
Log in to your cPanel as a root user.
Navigate to the ‘File Manager’ and select the ‘public_html’ directory of your WordPress installation.
Then, select all the files and right-click to select the ‘Compress’ option.
Then, select the compress file type and enter the name of the compressed archive.
Click the ‘Compress File(s)’ button.
Upload the Compressed File
After the download, you can upload the compressed file to the new hosting location via FTP or SSH. The SSH is faster than the FTP upload. To upload the compressed file to the new location, follow the below process.
Log in to the new hosting location via SSH as a root user.
Switch to the folder in which you want to upload a copy of your WordPress website.
Make sure that the folder is empty. If it is not empty, save all the essential files and folders to a safe location and then run the following command to empty the folder.
# rm -rf *
Then download and unzip the generated zip file.
# wget </URL/of/the/Zip/File> # unzip <filename>.zip
Replace the </URL/of/the/Zip/File> and <filename> flags in the above commands with the actual URL of the website zip file and name of the file, respectively.
All the web files got uploaded to the new location. After that, we need to import the database to the new location. To export the database from the current location, and then import it to the new location, follow the below process.
- Log in to the database manager (phpMyADmin) and select the database.
- Navigate to the ‘Export’ option and download the ‘.sql’ file.
- Then, log in to the new database manager and click the ‘Create Database’ button.
- Navigate to the ‘Import’ option.
- Click ‘Choose File’ and upload the downloaded ‘.sql’ file.
Update the wp-config.php
Next, you need to update the wp-config.php file to make sure that the WordPress installation on the new location gets connected with the new database. Go to the ‘public_html’ folder and open the ‘wp-config.php’ file. Then, enter the new database credentials.