How To Clone A Website In cPanel
Website cloning means copying or modifying/duplicating an existing website design or script to create a new website. Website cloning allows designers and entrepreneurs to create and start their own website business without the need to develop it from scratch. You might want to clone websites to your cPanel server for many reasons. Since the copies are identical to an existing website, cloning makes it possible to deploy test and staging sites. It's also a quick way to create a new site using the old one as a base.
Site owners use cloned sites to give designers and developers access to a working environment.. Cloning can be done from the command line, but it is time-consuming and mistakes are easy to make. cPanel and WHM automate the most error-prone steps so you can quickly clone sites based on content management systems and e-commerce applications.
We'll start with the fastest and most convenient way to clone a WordPress site using WordPress Toolkit, Softaculous and the manual process.
Clone a WordPress site with WordPress Toolkit
WordPress Toolkit automatically copies the site, creates a new database and a new database user, configures the site to use the database, and if necessary, creates a new subdomain.
- First, go to the WordPress Toolkit interface in WHM or cPanel
- Open WordPress Toolkit and expand the detailed view of the site you want to clone.
- After clicking Clone, a window will appear asking if you want to clone WordPress to a new subdomain or an existing domain.
- Click the Clone tool on the site dashboard.
- WordPress Toolkit creates the subdomain and location to clone the website if they don’t exist
- Select a subdomain and location to clone the site
- After setting up the subdomain, click Start at the bottom of the page and the cloning process will begin.
When the cloning is complete, you will receive a notification that your website has been cloned. When you're done, log in to the cloned site.
Cloning a Website Manually with cPanel
To clone a site, both static files and site’s database must be copied. Create a new folder and copy the site’s files into it. Export the original site’s database, create a new database for the clone, and import the data into it. Configure the clone to work with the new database. We’re going to focus on cloning a site into a new directory rather than a subdomain.
Create a Folder and Copy the Site’s Files We can create a folder for the site’s clone and copy the files in File Manager, which you can open from the Files section of cPanel’s main page menu.
Select the directory containing the WordPress site you want to clone.
Click Copy in the toolbar and enter a name for the new directory. To keep things simple, we’ll clone the site into a directory under public_html so that you can access it from a URL such as “example.com/testing WordPress.”
File Manager copies the directory and all of its contents, giving you an exact duplicate of the original site’s files.
Clone the Site’s Database
Cloning the database is straightforward with cPanel’s MySQL tools but a little more complicated than copying files.
- First, create a new database.
- Open MySQL Databases, which you’ll find under Databases the main page menu.
- Enter a name for the new database under Create New Database and click the Create Database button.
- Next, we export the original database. We’ll use phpMyAdmin, which is also under Databases in the cPanel menu.
- Select the original database in the sidebar.
- Select the Export tab and make sure the Quick export method is selected.
- The custom method lets you change database export options, but we’ll stick with the defaults.
- Click Go.
This “dumps” the database, downloading an SQL file to your local machine with the information needed to recreate the original site’s database. That’s what we’re going to do next, also using phpMyAdmin.
Select the new database (the one we created in the previous section).
Click on the Import tab.
In the File to Import section, click Choose File and locate the SQL file you just downloaded. Click the Go button at the bottom of the page.
The last step in this section is to provide the database with a user with a password. You can use an existing database user, but we'll add a new user and provide them with a unique password.
- Log into cPanel,
- Navigate to the MySQL databases page.
- Enter a username and a password under Add New User section.
- Click Create User, then return to the MySQL Databases page.
- Select the new user and the database we created in the previous section.
- Click Add
- Select "All Privileges" on the next page and confirm the changes.
The files and database have now been copied,, but our cloned WordPress site is still configured to use the original site's database. We will now configure the clone to use its own database.
Edit the cloned site's database and URL configuration.
This step is specific to WordPress, but you'll need to do something similar for other content management systems.
- Open the file manager and select the new site directory.
- Select the wp-config.php file.
- Click Edit on the toolbar.
- WordPress has to connect and authenticate with the new database, as such several fields in the MySQL settings section of wp-config.php need to be modified
- Enter the new database name in the DB_NAME field.
- Enter the user we just created in the DB_USER field.
- Enter the user's password in DB_PASSWORD.
- While wpconfig.php is open, we can also notify WordPress of its new URL.
- By adding the following lines, with the appropriate changes, to the bottom of the file.
<! – wp:paragraph – >
define( 'WP_HOME', 'http://example.com/testingwordpress' );
<! – wp:paragraph – >
define( 'WP_SITEURL', 'http://example.com/testing wordpress' );
- Save Changes when you’re finished.
You should now be able to load your cloned site at http://your_domain.com/your_subdirectory which will be something like http://example.com/testingwordpress.
Cloning a Website Using Softaculous
Softaculous, however, has a new clone feature that makes cloning much simpler. Since it leaves the original site in place initially, Below is a quick step-by-step guide on how to clone your site with Softaculous.
- Login to your cPanel account.
- Locate and click ‘Softaculous Apps Installer’.
- Click the application in which you want to clone and Click on ‘Clone’.
- Enter the Clone installation details.
- Click on All Installations, this will take you to the Clone Installation page. You can fill the required details of where you want your clone to go.
Choose Protocol: Stick with the default https://
Choose Domain and leave the In Directory blank(if you are moving to a subfolder, enter that here).
Database Name: Leave it as default or enter a database name
Once the required information for your clone has been filled in, click on the Clone Installation
Softaculous will install the clone to the new folder(domain/subdomain)you selected. It also clones the database as well so that each copy has its own. (Be sure that you have enough room on your hosting plan for the databases or your clone will fail).
This is how to clone a website.
Updated 7 months ago