How to clone your website to a dev subdomain

This article will show you how to clone your website to a dev subdomain.

The first thing you need to do is login to your website through FTP and:

  • set the transfer type to binary
  • download your website to your local computer.

The above steps can be avoided if your website’s CPanel will allow you to copy files from one directory to another. If it does, then login to your website’s CPanel and create a new “dev” directory in your website’s root. Then, copy all files from the root directory into it (except the dev directory you just created, obviously).

If your Cpanel doesn’t offer you this functionality, then connect through FTP to your website and create a new directory called dev. Next, download all files from the root directory somewhere on your local computer(except the dev directory you just created, obviously).

This was the first step, moving the files. The next (and the last) step includes migrating the database. You can do this in two ways:

  • either create a completely new database
  • or use the existent database

I recommend you to create a new database. You can assign the same user to it as to the one that supports the live website, so you won’t need to update those credentials in the wp-config.php file.

Now, for migrating the database, I will use the WP Migrate DB plugin. Login to your live website and go to Plugins > Add new. Search for WP Migrate DB plugin, install and activate it. Next, go to Tools > Migrate DB and configure the paths to the dev subdomain. For the sake of this example, your live website will be found here: and your root path will be /var/www/htdocs. Now, when configuring the paths to the dev subdomain, the paths must look like this:

  • //
  • /var/www/htdocs/dev

Once you’ve configured the export path, migrate the database. The plugin will take care of updating the paths properly. After you have downloaded the export sql archive, conect to your database server (usually PhpMyAdmin through your CPanel) and import the migration script (it will be the sql file inside the archive you’ve just downloaded).

The next thing to do is update in the dev website the wp-config.php file:

  • the database name,
  • the database user
  • the database user password

so it will connect to the new database. Once you do that, when accessing you should see the exact website as on your live website.

That is all there is to cloning your live website to a dev subdomain. This approach is recommended because you can use this dev subdomain to test theme updates, plugin updates and even WordPress updates before applying the changes to your live website, so if anything breaks, your live website will still be functional.

If you have any questions regarding this subject, please address them on our forums.