{"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
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 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 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 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 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 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 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 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 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 Next, we export the original database. We\u2019ll use phpMyAdmin, <\/em>which is also under Databases <\/em>in the cPanel menu. <\/p>\n\n\n\n This \u201cdumps\u201d the database, downloading an SQL file to your local machine with the information needed to recreate the original site\u2019s database. That\u2019s what we\u2019re going to do next, also using phpMyAdmin. <\/em><\/p>\n\n\n\n The last step in this section is to give the database a user with a password. You can use an existing database user, but we\u2019ll add a new user and give them a unique password. <\/p>\n\n\n\n In cPanel, navigate to the MySQL Databases <\/em>page. Scroll to the Add New User <\/em>section. <\/p>\n\n\n\n We now have the files and the database copied, but our cloned WordPress site is still configured to use the original site\u2019s database. The next task is to configure the clone to use its own database.<\/p>\n\n\n\n This step is WordPress-specific, but you will have to do something similar for other content management systems. <\/p>\n\n\n\n We need to edit several fields in the MySQL settings section of wp<\/em>–config.php <\/em>so that WordPress can access and authenticate with the new database. <\/p>\n\n\n\n While we have wp-config.php <\/em>open, we can also tell WordPress about its new URL. There are various ways to do this, but the quickest is to add the following lines, with appropriate changes, to the bottom of the file. <\/p>\n\n\n\n Don\u2019t forget to click Save Changes<\/em> when you\u2019re finished. <\/p>\n\n\n\n All being well, you should be able to load your cloned site at http:\/\/your_domain.com\/your_subdirectory<\/a>. If you\u2019ve followed the examples, that will be something like http:\/\/example.com\/wordpress_two<\/a>. <\/p>\n\n\n\n As always, if you have any feedback or comments, please let us know. We are here to help in the best ways we can. You\u2019ll find us on Discord<\/a>, the cPanel forums<\/a>, and Reddit<\/a>. You\u2019ll find us on Discord<\/a>, the cPanel forums<\/a>, and Reddit<\/a>. Be sure to also follow us on Facebook<\/a>, Instagram<\/a>, and Twitter<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" 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. There are many reasons you might want to clone websites […]<\/p>\n","protected":false},"author":77,"featured_media":65781,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[289,61],"tags":[],"class_list":["post-61161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general-knowledge","category-tips-and-tricks"],"acf":[],"yoast_head":"\nCloning a WordPress Site with WP Toolkit<\/strong><\/h2>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
How to Manually Clone a Website with cPanel<\/strong><\/h2>\n\n\n\n
Create a Folder and Copy the Site\u2019s Files<\/strong><\/h3>\n\n\n\n
<\/figure>\n\n\n\n
Clone the Site\u2019s Database<\/strong><\/h3>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Edit the Cloned Site\u2019s Database and URL Configuration<\/strong><\/h3>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<!-- wp:paragraph -->\n<p>define( 'WP_HOME', 'http:\/\/example.com\/wordpress_two' );<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>define( 'WP_SITEURL', 'http:\/\/example.com\/wordpress_two' );<\/p>\n<!-- \/wp:paragraph --><\/code><\/pre>\n\n\n\n