In your workflow there may be times when you want to clone a duplicate of a site to a new URL, for example:
- If your workflow entails using a development URL during development before transferring to a final production URL when a project is finished.
- You might have a site as a blueprint site that you use as a foundation to work from, including a set of preinstalled themes and plugins with your most common option configurations.
You can use the GridPane single site migration/cloning tool located in the site backups to do this. This tool can be used for cloning a duplicate site to the same server or to another destination server.
This article is for cloning a duplicate site to a different server, if you want to clone a duplicate to the same server, please read this article.
What Settings Clone Across
Cloning a duplicate site with a new URL to a different server will replicate a near identical state for the new site. The duplicate site will belong to the same owner if that user exists on the server, and it will match all the main control panel settings, including:
- WordPress Core
- WordPress Database structure
- System User (this will be created if it doesn’t already exist)
- PHP version and settings
- All General customizer settings, including caching
- All Security customizer settings
- Routing (www or none/root)
We will also duplicate your site-specific PHP in settings and PHP process manager settings that GP-CLI manages, alongside the GP-CLI adjusted site-specific Nginx settings and any includes in your site-level Nginx or OpenLiteSpeed (OLS) directory.
There are 2 things that don’t currently transfer over when cloning. These are:
- HTTP Auth
Like any migration, always be sure to check your website over and make sure you’re settings are all correct before changing your DNS records.
In this article, we will be using an example development site
development.laser-cats.monster on an origin server called
origin, to illustrate the steps to migrate this site to a new url of
laser-cats.monster on a destination server named
destination (original I know).
Step 1. Preparation
Before you begin, there may be a few preparation steps you need to take. We also highly recommend that you review the information in this article:
SERVER-WIDE CONFIGS OR CUSTOM WORK
If you’ve set up any server-level configs, such as an Nginx config for using WP Rocket for Nginx or enabling webp, then you’ll also need to make sure these are set up once again on the new server.
Unlike site-specific configurations, these will not be cloned across when moving sites from one server to another.
If you’ve added anything custom, such as installing additional software or server-level cronjobs, then you will also need to manually move/install/recreate these on your new server if they are still needed.
For your clone to begin, our systems require that your destination server has at least 110% of the origin site in free disk space. Please ensure you have ample free disk space before you proceed.
SSL Preparation (if applicable)
An SSL attempt will be made for the newly cloned site IF SSL is enabled on the original site. For this reason, it is important to make sure that your DNS is resolving correctly for the newly cloned site before you attempt cloning. This will speed up the search and replace because the system will just run a single compound regex.
If DNS is not resolving, the clone will proceed as normal, but the SSL attempt will fail, and GridPane will ensure that all URLs in the database for the new site are replaced with HTTP variants, and this requires 3 passes instead of 1. You can then manually enable SSL later.
You can learn more about GridPane search and replace functions here:
Step 2. Open the Website Customizer
Click on the Sites link in the GridPane main menu to go to the Sites management page.
Click on the URL of the site you want to clone a duplicate of in the active site’s panel.
This will open the site customizer.
Step 3. Configure Your URL and Destination Server
Click through to the Clone tab in the site customizer. Here you will find the Migrate/Clone tools:
Here we’ll make use of the second option.
Enter the new URL you’d like to clone your website to, and then select the new server from the dropdown list.
Please remember do not enter the URL with the www host included.
Step 4. Configure Your Integrations and Database Rewrites
Click the Migrate/Clone button to open the additional options modal:
This will present you with twp dropdowns where you can select your SMTP Integration and DNS API Integration settings in advance if you’d like the cloning process to configure them for you automatically on the destination site.
You can also select if you want to “Include Database Rewrites“:
Generally, you’re going to want to run database rewrites. This will run a search and replace and ensure that all of your URLs are set correctly. Two options are available to you:
InterconnectIT is usually the best option as it’s more comprehensive. WP-CLI might be a little quicker, but it also has a higher chance of missing some rewrites.
Your server will begin to clone the duplicate clone site to the destination server immediately.
Please be patient while the duplicate cloning process is ongoing and refrain from making any changes to your site and either the origin server or the destination server.
You will receive a string of notifications to keep you informed about how the migration/clone is proceeding throughout the process. Please pay attention to these.
When the process is complete, your new site will appear in the active sites list.
Your settings on your newly cloned website will match up with your origin site.
Step 5. Check Your Cloned Website
You should check your duplicate site to make sure everything is as expected. The content and database will have been cloned across, and the URLs and file paths will have been updated to the new URL.
We will have matched most states for the GridPane features, including all PHP ini settings, PHP process manager settings, and Nginx configuration settings that have been adjusted by GP-CLI. We will also have migrated across cloned files from your Nginx includes directory.
Please ensure that everything has cloned correctly before deleting your previous site, and consider keeping the original for 1-2 weeks while backups on the new server have time to take place.
Cloning and Staging Websites
You can clone staging sites to a different URL either on the same server or a new server if you have a need to do so though. You will find the same options for cloning in your staging site’s customizer, and you can follow the same steps above like you would when cloning a production website.
One thing you can’t do, however, is create or clone staging sites to “staging” subdomains on GridPane. For example, if you try to create the website “staging.website.com” as a regular site, it will fail and result in an error message. This will also fail in the exact same way during the cloning process.
Cloning Staging + Live Site Together
Cloning both the production website along with its existing staging site is something that isn’t possible at this time. Each can be cloned individually, but not as a couple.s