Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How to Clone a Website (A Step by Step Guide)

December 30, 2019

7 Min Read
Reading Time: 7 minutes

Website cloning is the process of creating a replica of your website. By doing so, you can create blueprints, test compatibility, perform updates safely before implementing the changes on your live website.

In this guide, I will cover a few of the use cases where website cloning can solve the problem and then discuss several ways to clone a WordPress website.

When Do You Need to Copy a Website?

Creating an exact copy of a website is something that every WordPress power user should be able to do. This is particularly helpful for web agencies that run several websites across multiple WordPress hosting providers. Whenever an issue arises, they can create a copy of the client’s website and try out various fixes until the problem is resolved.

Consider the scenario where you have three websites on a server and you want to update the theme on the third website. Here’s how you can safely do that without breaking anything – clone the website, test, and when you are done with testing, either remove the previous version or make the clone the primary version.

Here are a few use-cases when you might need to clone a website.

  • Compatibility Test
  • Move Your Website to a New Server
  • Back up Your Website
  • Clone Website for a Similar Project
  • Compatibility Test

– Compatibility Test

Compatibility Testing involves checking whether the website components are working as expected and the entire code base is capable of running on various hardware and/or software infrastructure.

It is always recommended to test changes on a staging/cloned website instead of a live website, mainly because untested themes and plugins could conflict with the existing installation and bring down the entire website. Similarly, any custom changes in the code need to be tested at a staging/cloned site before it can be pushed to the live site.

– Move Your Website to a New Server

If you want to transfer a website to a different hosting provider, you can create a clone by backing up website files, databases, and import the whole package to the new web hosting provider.

The process seems easy. However, things could go wrong and you could end up with a “broken” archive.

– Back up Your Website

Cloning is also used to back up a website (including web files and database) and keep it at an offsite location for disaster recovery. In the case of WordPress, many people use different WordPress backup plugins.

I will also cover the process of copying a website that can be used to create a backup of your website.

– Clone Website for a Similar Project

If you are a web agency or build websites for clients, you may want to create a blueprint and copy it to another location to speed up the development process. Most of the time these setups include theme & plugins configurations, code-level customizations, etc.

– Take a Website Live

It’s common for developers to build websites on their preferred local environment and then clone the website to a web hosting server to make sure things do not break during the transition. This setup also requires a complete backup of website files and database.

How to Clone a Website?

As discussed above, I will use a WordPress website as an example throughout this guide.

There are multiple ways to clone a WordPress website but in this guide, I will cover:

  1. Duplicate a Website Through Your Web Hosting Provider
  2. Clone a WordPress Website Using a Plugin
  3. Manually Clone a WordPress Site

– Duplicate a Website Using Your Web Hosting Provider

WordPress hosting providers like Cloudways allow you to create a duplicate of your website to the same and/or another server on their platform. This saves a lot of complexities and reduces the steps of the process.

Cloudways has greatly simplified the process of how to clone a website. Simply go to the application you wish to clone.

cloudways application interface

Hover on the bottom right button. To duplicate a website, click Clone App/Create Staging.

clone app or create staging

A popup will appear asking if the customer wants to Clone App or Create Staging. Click the dropdown and select the server on which you want to create a copy of the website and click Continue.

select server to clone website

The Cloudways Platform takes a few minutes to copy a website.

Note that “Clone App” and “Create as Staging” are different in nature. Clone App only clones a website while in the process of creating a staging site, both the live and staged applications are synced so that you can perform Push/Pull actions on both the replica and live versions.

– Clone a WordPress Website Using Plugins

Like every other aspect of website management, WordPress has a lot of plugins that can be used to clone a WordPress website. One of them is All-in-One WP Migration, a simple and easy way to use a backup and migration plugin for cloning a website. It allows you to export your existing WordPress website and then import it at a new location.

Within your old WordPress installation, navigate to Plugins → Add New, search for All-in-One WP Migration, Install and Activate the plugin.

install all-in-one wp migration

From the left pane, navigate to All-in-One WP Migration → Export and Click the EXPORT TO dropdown, and select FILE.

all-in-one wp migration export site

Wait for a few seconds and a popup will appear asking you to download the backup.

download your backup file

Download the file to your computer, the format will be .wpress. Keep it safe as you would need it in the next steps.

Install a fresh WordPress on the new location, login and install the All-in-One WP Migration plugin. From the left pane, navigate to All-in-One WP Migration → Import and click the IMPORT FROM dropdown, and select FILE.

all-in-one wp migration import site

Browse the previously downloaded .wpress file.

Note: There is a chance that you might see the warning “Your file exceeds the maximum upload size for this site”. To deal with the issue, make sure that the maximum upload file size limit is greater than the size of the .wpress file. All in One Migration has a guide to increase file upload size limit or if you are a Cloudways customer, have a look at this guide.

The process takes a while as it involves uploading and extracting the .wpress file. Once done, you will get a popup with a warning. Click Proceed.

all-in-one wp migration warning

On the next popup, click “Save permalinks structure”.

successful website import

You will be taken to the WordPress login page. Login with the admin credentials of your old WordPress installation (because the original database has been replaced with the old WordPress website’s database). Click “Save Changes” on the Permalinks tab and you are done!

Hurrah! You have successfully created a clone website.

– Clone a WordPress Site (Manually)

The manual process involves compressing all WordPress files and folders, exporting the old database and then importing the WordPress files and database to the new location.

Here are the steps to copy a website to a new location or the hosting provider.

  1. Compress WordPress Files
  2. Upload the Compressed File
  3. Migrate the Database
  4. Update the wp-config.php

1. Compress WordPress Files

First of all, navigate to the public_html directory of your WordPress installation, select all files and compress them into a single archive.

compress wordpress files public_html

You now have a zip file in the public_html folder, and the URL will be example.com/FILE_NAME.zip.

Now, you have two options – either download the zip file and upload it to the new location via an FTP client like FileZilla or upload the zip file to the new location directly via SSH [faster than the FTP upload].

2. Upload The Compressed File

In my example, I will use the SSH because of the speed advantage. I logged into the new hosting location via SSH and browsed to the location/folder where I want to have a copy of my WordPress website. Make sure the folder is empty (if not, use the following command to remove everything).

rm -rf *

Important: The deletion process is irreversible. So before executing a command, move all important files and folders to a safe location.

Now, use the following command to download the generated zip file.

wget URL_OF_ZIP_FILE

Don’t forget to replace the URL_OF_ZIP_FILE with the actual URL of the zip file.

Next, use the following command to unzip it.

unzip FILE_NAME.zip

All folders and files will be extracted in the target folder.

3. Database Migration

After copying web files, the next step involves exporting the database from the current location and importing it at the new location.

Login to your database manager (phpMyAdmin is a popular choice). Select your database and navigate to Export. Download the exported .sql file.

Log in to the new database manager, create a database, and navigate to Import. If you already have a database, simply import the downloaded .sql file.

Click Choose File and upload the previously downloaded .sql file.

4. Update the wp-config.php

Since the website is already up and running, the wp-config.php file needs to be updated so that the WordPress installation on the new location can be connected with the new database.

Get to the public_html folder, open wp-config.php file and enter the new database credentials.

And you are done!

If you still see old URLs anywhere on the website, replace them by using Better Search Replace plugin.

By following one of the above methods, you can clone a website from one location to another. Generally, there are three steps involved: Move the web files, Export & Import Database, and update the configuration file.

If you still have any questions, feel free to ask in the comment section below.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Start Growing with Cloudways Today!

We never compromise on performance, security, and support.

Mustaasam Saleem

Mustaasam is the WordPress Community Manager at Cloudways - A Managed WordPress Hosting Platform, where he actively works and loves sharing his knowledge with the WordPress Community. When he is not working, you can find him playing squash with his friends, or defending in Football, and listening to music. You can email him at mustaasam.saleem@cloudways.com

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

BFCM 2019