Website cloning allows you to easily create a replica of your website design or content. Website cloning allows developers and designers to create blueprints, verify compatibility, and make updates before you implement the changes on your website live.
This guide will discuss cloning WordPress websites and briefly cover some of the possible use cases.
How to Clone Website
- What is the best time to copy a website?
- Compatibility Test
- Move your website to a new server
- Backup Your Website
- Clone Website to a Similar Project
- Create a Website Live
- How do I copy a website?
- Copy a website using your Web Hosting Provider
- Clone WordPress Websites Using Plugins
- Clone WordPress Sites (Manually).
What is the best way to copy a website?
Every WordPress power user should know how to create an exact copy of a website. This is especially useful for web agencies that manage multiple websites hosted by different WordPress hosting providers. They can make a copy of their client’s website to try different fixes whenever an issue occurs.
Imagine that you have three websites and want to update the theme of the third one. This is how you can do it safely and without breaking anything: clone your website, test, then remove or make the clone of the primary version.
These are some examples of situations where you might need to clone websites.
- Compatibility Test
- Transfer Your Website to a Different Server
- Backup Your Website
- Clone website for similar projects
- Compatibility Test
– Compatibility Test
Compatibility Testing is the process of ensuring that website components work as expected and that the code base can run on different hardware and/or software infrastructures.
Test any changes on a staging/cloned site instead of a live one. This is because plugins and themes that are not tested can cause problems and even shut down the whole website. Any custom code changes must be tested on a staging/cloned website before they can be pushed to a live site.
– Move your website to a new server
You can create a copy of your website and back up all files and databases to make it easy to move to PHP Hosting or another Hosting provider. Then, import the entire package to the new hosting provider.
It seems simple. But, it is possible for things to go wrong, and you may end up with an “unreadable” archive.
– Backup Your Website
Cloning can also be used to backup a website, including web files and databases, and store it at an offsite location in case of a disaster. Many people use different WordPress backup plugs.
I will also discuss the process of copying websites that can be used for creating a backup.
– Clone Website for Similar Projects
You may need to create a blueprint if you work for a web agency and want to quickly develop websites for clients. These setups usually include code-level customizations and theme & plugin configurations.
– Make a website live
Developers often build websites in their local environment, then copy the website to a web host server to ensure that things don’t break during the transition. This setup requires a backup of all website files and databases.
How do you Clone a Website?
As I mentioned above, I will be using a WordPress website as an example throughout the guide.
There are many ways to clone WordPress websites, but this guide will focus on the following:
- You can duplicate a website through your web hosting provider
- Clone WordPress Websites Using a Plugin
- Manually Clone a WordPress Website
Using your Web Hosting Provider, duplicate a website.
Cloudways, WordPress hosting provider, allows you to create a duplicate website on the same or another server on their platform. This reduces complexity and simplifies the entire process. You can find out more about the platform by looking at the pricing plans of its partners, Digital Ocean and Google Cloud Platform.
Cloudways makes it easy to clone websites. Go to the app you want to clone.
Click the button at the bottom. Click clone App/Create Stage to duplicate a website.
A popup will ask the customer if they want to Clone App or Create Staging. Select the server from the dropdown, and click Continue.
It takes just a few seconds to create a website on the Cloudways Platform.
It is important to note that ” Clone app” (or ” Create As Staging) are two different things. Clone app clones websites while creating a staging site. Both live and staged versions are synced to allow Push/Pull actions to be performed on both the replicas and the live ones.
Clone WordPress Websites Using Plugins
WordPress offers many plugins that can be used for cloning a WordPress site. One of these plugins is All-in-One WP Migration. It’s a quick and simple way to back up your website and migrate the plugin. You can export your WordPress website and import it to a new location.
Navigate to plugins – Add new to your WordPress installation. Search for All In One WP Migration. Install. Activate.
Navigate to All in One WP Migration – Export. Click the EXPORT TO dropdown and choose FILE.
Wait for a few seconds, and then a popup will ask you to download the backup.
Save the file to your computer. The format is .wpress. It is important to keep it safe for the next steps.
Create a new WordPress in a new location. Login and install the All-in-One WP migration plugin. Navigate to All-in-One WP Migrator – Import from the left pane. Click the IMAGINE FROM dropdown and choose FILE.
Browse the previously downloaded. wpress files.
You might get the warning ” Your upload exceeds the site’s maximum size” You can resolve the problem by ensuring that your maximum upload file size is not greater than the file in. wpress. All in One Migration offers a guide increase upload size limit. Cloudways customers can also consult this guide.
It takes some time as the upload and extraction of the.wpress files is involved. After the upload is complete, you will see a popup warning you. Click Proceed.
In the next popup click ” Save Permalinks Structure”.
The WordPress login page will open. Log in with your admin credentials from the old WordPress installation. This is because the database was replaced by the new WordPress website’s database. You are done when you click ” Save All Changes” in the Permalinks tab.
Hurrah! You have created a cloned website.
Clone WordPress Sites (Manually).
This manual process involves compressing all WordPress folders and files, exporting the database and then importing them to the new location.
These are the steps for copying a website from one location to another or to the Hosting provider.
- Compress WordPress Files
- Upload the compressed file
- Transfer the Database
- Update the wpconfig.php
1.Compress WordPress Files
Navigate to the directory in your WordPress installation. Next, choose all files and then compress them into one archive.
You now have a zip file in the public_html folder, and the URL will be example.com/FILE_NAME.zip.
You have two choices: either download the zip file, and upload it to the destination via FileZilla’s FTP client or upload the zip file directly via SSL [faster than FTP upload]
2. Upload the Compressed File
Because of its speed advantage, I will use SSH in my example. After logging in to my new Hosting location using SSH, I browsed to the folder where I wanted to keep a copy. You can make sure that the folder is empty by using the following command.
- rm-rf *
Important: Deletion is irreversible. Before you execute a command, make sure to move all files and folders to a safe place.
Use the following command to obtain the zip file generated.
- wget URL_OF_ZIP_FILE
Do not forget to replace URL_OF_ZIP_FILE by the actual URL for the zip file
The next step is to use the following command: Unzip it
- unzip FILE_NAME.zip
All files and folders will be removed from the target folder.
3. Database Migration
After copying web file, the next step is exporting your database from the current location to the new one.
Log in to your database manager (phpMyAdmin is a favorite choice). Navigate to Export and select your database. The .sql file can be downloaded.
Log in to the database manager and create a new database. Next, navigate to Import. You can import the.sql file if you already have a data base.
Click Select File to upload the previously downloaded.sql file.
4. Update the wpconfig.php
The website is up and running so the wpconfig.php file must be updated to allow the WordPress installation at the new location to be connected to the database.
Navigate to the folder and open WP-config.php. Enter the new database credentials.
You are done!
You can replace any URLs that are still visible on your website by installing the Better Search Replace plugin.
You can copy a website by following any of the methods above. There are generally three steps: Move web files, export & import database, and update configuration file.
You can still ask questions in the comments section below.