How to Clone a Website Within cPanel

How to Clone a Website Within cPanel

A cloned site is an exact copy of a website that is hosted by your web server. It uses the same files, and its contents in the database are identical to the original. The only distinction is that a different site or directories host the cloned siteYou may want to copy websites hosted on your cPanel server for many reasons. Since they are similar to the existing site, cloning can help create staging and testing websites. It’s also a simple method of setting up an entirely new website with the existing one as a reference configuration. Site owners frequently use cloned websites to allow developers and designers access to a work environment similar to the real-world environment.

Cloning can be accomplished via the command line. However, it’s time-consuming and easy to make mistakes. cPanel and WHM automate more error-prone processes, which means it is easy to clone sites built upon content management systems and eCommerce apps.

This article examines two ways to clone websites that cPanel manages:

How to manually copy the Website using cPanel

Content management systems, such as WordPress, Joomla, and Drupal, comprise two major asset types. The first type is PHP code files and static files like photographs, JavaScript files, and CSS. The second is the information stored in the site’s Website’s database, including page content, configuration settings, user data, and other information.

To duplicate a site, you must copy both sites, and the procedure looks like this:

  1. Create a folder in a different location and transfer the site’s data.
  2. The original database on the site is exported, and create a new one for the clone, then the data with it.
  3. Configure the clone to be compatible with the database you have made.

Let’s look at how we can use this technique to copy an existing WordPress website. We’ll focus on cloning a website into a directory rather than a subdomain.

Clone the Site’s Database

Cloning a database is slightly more complex than copying files. However, it’s easy to use the cPanel’s MySQL tools.

The first step is to make a database from scratch.

  • Access MySQL Database, which is located under Databases on the main menu.
  • Give a name to your new database in the section with the heading Create New Database and click the Create Database button.

The final step in the section is to grant the database a user with an account password. It is possible to utilize an already existing database account. However, we’ll create a new user and give them an individual password.

In cPanel, go through your MySQL Databases page. Scroll to the Add New User section.

  1. In the “Add New User” section, create a username and enter a secure password.
  2. Select to create a user, and then return to the MySQL Databases page.
  3. Under the Add Users to Database, choose the user you want to add and the database we created in the earlier section.
  4. Select to add, select “All Privileges” on the next page. Confirm the modifications.

We now have the files and database copied; however, the replicated WordPress website is still set up to use the database from the original site. The next step is to set up the clone to use the database of its choice.

Edit the Cloned Site’s Database and URL Configuration

This is a WordPress-specific step. However, you must follow the same procedure as other content management systems.

  1. Start the File Manager and choose the directory for the new site.
  2. Choose the WP— config. phpfile.
  3. Select the Edit button in the Toolbar.

We must edit several fields within the MySQL settings section of the the config. Php so that WordPress can authenticate and access the database that has been updated.

  1. Input the name of the new database into the DB_NAME field.
  2. You can enter the user that we registered in the database_USER fields.
  3. The password for the user is entered in the DB_PASSWORD table.


Leave a Reply