WordPress Tutorials
How to Clone WordPress to Folder

How to Clone WordPress to Folder

If you need to copy your WordPress website in order to test new changes in a safe environment, you can easily do so via our Staging tool, located in Site Tools, or by cloning your site to a different folder. Below, we explain how to clone your WordPress website. If you want to learn more about the Staging tool, read this tutorial.

Create the new folder (if it does not exist)

The first step in moving or copying your website to a new location is to create the new directory. You can do that via the File manager tool or via your favorite FTP client. For more information on how to use FTP, check our FTP Tutorial.

Create a copy of the files

Once the destination folder is created, copy the website’s files in it. Again you can do that via the File manager tool or over FTP client. You need to copy all files from the WordPress website’s folder to the destination folder. Make sure that you do not forget the .htaccess file which is hidden and might not be visible. Double-check if all related files have been copied to the new folder.

Create a copy of the database

Now you need to export your database. If you are not certain what is the database name, you may look it up in the wp-config.php file. To export it, follow the instructions here. After you have your data exported, create a new database, and import the content in it.

Reconfigure WordPress to work with the new URL

Reconfigure your WordPress application to work from the new folder with the new database. To do this, open the wp-config.php file in the WordPress website’s folder and locate the following lines:

define('DB_NAME', 'user_wrdp1');
/** MySQL database username */
define('DB_USER', 'user_wrdp1');
/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'hostname');

You need to replace those values with your new database, database username and password for it. Make sure that the hostname is localhost. Then save the file and the copy of your website should be ready. You should make sure to update the WordPress URLs to the new one as well. You can check this article on how to do that.

Tutorial Menu

Share This Article