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 the same server, ff you want to clone a duplicate to another server we have a separate KB document for that.
Cloning a duplicate site with a new URL on the same server
Cloning a duplicate site with a new URL on the same server will replicate a near identical state for the site. The duplicate site will belong to the same owner, and it will match all the main control panel settings including:
- WordPress Core
- WordPress Database Structure
- System User
- PHP version and settings
- HTTP Auth
- Nginx settings
We will also duplicate your site specific PHP ini 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 directory.
Cloning a duplicate site with a new URL on the same server currently can't also adjust the www/root routing of the newly cloned server. For the time being this needs to be adjusted manually.
In this article we will be using an example development site
development.laser-cats.monster to illustrate the steps to migrate this site to a new url of
laser-cats.monster on the same server.
Step 0. Ensure DNS resolution for your newly cloned site.
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.
If DNS is not resolving the clone will proceed as normal and the SSL attempt will fail and GridPane will ensure that all URLS in the database for the new site are replaced with http variants. You can then manually enable SSL later.
Step 1. Go to the Sites Section of the GridPane Control Panel
Click on the Sites link in the GridPane main menu to go to the Sites management page.
Step 2. Open the site customizer for the site you wish to clone a duplicate of
Click on the url of the site you want to clone a duplicate of in the active sites panel.
This will open the site customizer.
Step 3. Locate the Migrate/Clone tool in the Site Customizer Backups tab
Click on the backups tab in the site customizer.
In the backups tab you will find the Migrate/Clone tool.
Step 4. Configure Migrate/Clone for same server and new url duplicate cloning
First make sure Migrate/Clone radio button is selected.
Make sure New Site URL radio button is selected, and enter your desired new url in the input box. Please remember do not enter the url with the www host included.
In the dropdown selector choose the same server
Step 5. Click Migrate/Clone Now
Click the Migrate/Clone Now button to start the server process. Your server will begin to clone the duplicate clone site immediately.
Please be patient while the duplicate cloning process is ongoing and refrain from making any changes to your site and server.
You will receive a string of notifications to keep you informed about how the migrate/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.
With a matching state to the origin site.
Step 6. Adjust WWW/Root routing if necessary
Unfortunately at the moment the clone/migrate tool does not automatically adjust www/root routing on the duplicate site to match the origin site. If you have your origin site routing to either www or root and wish for the duplicate clone to also follow this routing scheme then you will need to make these adjustments manually once the clone is complete.
Step 7. Check your cloned duplicate site
You should check your duplicate site to make sure everything is as expected. The content and db will have been cloned across and the URLs and filepaths 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.