{"id":61161,"date":"2021-05-20T10:13:13","date_gmt":"2021-05-20T15:13:13","guid":{"rendered":"https:\/\/blog.cpanel.com\/?p=61161"},"modified":"2021-05-20T10:13:13","modified_gmt":"2021-05-20T15:13:13","slug":"how-to-clone-a-website-in-cpanel","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/tips-and-tricks\/how-to-clone-a-website-in-cpanel\/","title":{"rendered":"How To Clone A Website In cPanel\u00ae"},"content":{"rendered":"\n

A cloned website is a perfect duplicate of a site hosted on your server. It has the same files, and the contents of its database are identical to the original. The only difference is that the cloned site is hosted at another domain or directory. <\/p>\n\n\n\n

There are many reasons you might want to clone websites on your cPanel server. Because the copies are identical to an existing website, cloning helps deploy testing and staging sites. It\u2019s also a quick way to set up a new site using the old one as a baseline configuration. Site owners often use cloned sites to give designers and developers access to a working environment that behaves like the live environment. <\/p>\n\n\n\n

Cloning can be done on the command line, but it\u2019s time-consuming, and it\u2019s easy to make a mistake. cPanel & WHM automates the more error-prone steps, so you can quickly clone sites based on content management systems and eCommerce applications.\u00a0<\/p>\n\n\n\n

This article looks at two strategies for cloning sites on your cPanel-managed server:<\/p>\n\n\n\n

  1. A generic cloning process that works for most CMS or eCommerce sites, although we will use WordPress as an example.\u00a0<\/li>
  2. A WordPress-specific process within WP Toolkit<\/em>, which makes cloning a one-click task by automating copying and site configuration.\u00a0<\/li><\/ol>\n\n\n\n

    We\u2019ll start with the quickest and most convenient way to clone a WordPress site in WP Toolkit <\/em>before exploring a more manual process that will also work with other content management systems. <\/p>\n\n\n\n

    Cloning a WordPress Site with WP Toolkit<\/strong><\/h2>\n\n\n\n

    Open WP Toolkit<\/em> and expand the detail view for the site you would like to clone. Click the Clone<\/em> tool in the site\u2019s dashboard. <\/p>\n\n\n\n

    \"\"<\/figure>\n\n\n\n

    When the clone tool opens, select a subdomain and a path to clone the site to. If they don\u2019t exist, WP Toolkit creates them for you. When you\u2019re finished, click Start <\/em>at the bottom of the page.\u00a0<\/p>\n\n\n\n

    \"\"<\/figure>\n\n\n\n

    WP Toolkit automatically copies the site, creates a new database and database user, configures the site to use the database, and creates a new subdomain if necessary. Once it\u2019s done, you access the cloned site as usual.\u00a0<\/p>\n\n\n\n

    You can learn more about WP Toolkit\u2019s <\/em>sophisticated cloning and copying features in How to Deploy a WordPress Staging Site With cPanel<\/a> or explore more of WP Toolkit\u2019s many WordPress management features<\/a>.\u00a0<\/p>\n\n\n\n

    How to Manually Clone a Website with cPanel<\/strong><\/h2>\n\n\n\n

    Content management systems\u2014including WordPress, Joomla, and Drupal\u2014are composed of two main asset types. The first is PHP code files and static files such as images, JavaScript files, and CSS. The second is information stored in the site\u2019s database\u2014page content, configuration settings, user information, and so on. <\/p>\n\n\n\n

    To clone a site, we have to copy both, so the process looks like this:<\/p>\n\n\n\n

    1. Create a new folder and copy the site\u2019s files into it. <\/li>
    2. Export the original site\u2019s database, create a new database for the clone, and import the data into it. <\/li>
    3. Configure the clone to work with the new database. <\/li><\/ol>\n\n\n\n

      Let\u2019s see how we\u2019d use this process to clone a WordPress site.  We\u2019re going to focus on cloning a site into a new directory rather than a subdomain. <\/p>\n\n\n\n

      Create a Folder and Copy the Site\u2019s Files<\/strong><\/h3>\n\n\n\n

      We can create a folder for the site\u2019s clone and copy the files in File Manager, <\/em>which you can open from the Files <\/em>section of cPanel\u2019s main page menu.<\/p>\n\n\n\n

      1. Select the directory containing the WordPress site you want to clone. <\/li>
      2. Click Copy <\/em>in the toolbar and enter a name for the new directory. To keep things simple, we\u2019ll clone the site into a directory under public_html<\/em> so that you can access it from a URL such as \u201cexample.com\/wordpress_two.\u201d <\/li><\/ol>\n\n\n\n
        \"\"\/<\/figure>\n\n\n\n

        File Manager <\/em>copies the directory and all of its contents, giving you an exact duplicate of the original site\u2019s files. <\/p>\n\n\n\n

        Clone the Site\u2019s Database<\/strong><\/h3>\n\n\n\n

        Cloning the database is a little more complicated than copying files, but it\u2019s straightforward with cPanel\u2019s MySQL tools. <\/p>\n\n\n\n

        First, we create a new database. <\/p>\n\n\n\n