Create a test copy of your site
Create a test copy of your site on Plesk, with WP Toolkit for WordPress or manually for other sites, then publish your changes safely.
On this page
Your values
Enter them once and the commands in this guide update.
A test copy lets you try an update, a plugin or a redesign without touching the site your visitors see. On Plesk, it is generally placed on a subdomain, such as test.your-domain.com.
There are two methods:
- WordPress site: cloning with WP Toolkit copies the files and the database, then adapts the address.
- Other site: you copy the files and the database, then adapt the configuration by hand.
Prerequisites
- Access to Plesk, see Connect to Plesk interface.
- A recent backup of the site.
- Enough disk space for a second copy, and a database available if the site uses one.
- A certificate covering the subdomain if you want to access it over HTTPS, see Enable a Let's Encrypt certificate.
Some plans include only one site and one database: check yours on the hosting plans page.
Method 1: clone a WordPress site
- Open the WordPress menu in Plesk.
- On the site card, click Clone.
- Keep Create subdomain. The suggested prefix is
staging, and you can change it. - If needed, change the name of the database created for the copy.
- Click Start.
The clone then appears in the list of the WordPress menu.
On the clone's card, then check that Search engine indexing is turned off, and turn on Password Protection.
Publish the tested changes
- On the clone card, click Copy Data.
- In Target, select the production site.
- In Data to Copy, choose what must be transferred.
- Keep Create a restore point selected.
- Click Start.
| Choice | Effect |
|---|---|
| Files Only | Copies WordPress, themes and plugins, without the database |
| Database Only | Copies only the selected tables |
| Files and Database | Copies both |
The target site goes into maintenance during the operation. Clear the source's cache before you start if it uses a caching plugin. If the source's WordPress version is older than the target's, the copy is canceled.
A restore point does not replace a backup. Also back up production before the copy.
Method 2: copy another site
Step 1: create the subdomain
- Go to Websites & Domains, then click Add Subdomain.
- In Subdomain name, enter
test, for example. - In Document root, specify a folder specific to the subdomain, for example
test, and not thehttpdocsfolder of the main site. - Click OK.
If your DNS is managed outside Plesk, also create a record for test.your-domain.com, see Connect a domain registered elsewhere.
Step 2: protect the copy
Before copying the files, protect the subdomain with / by following Password-protect a folder. This way, the copy will be neither visible to the public nor indexed.
Step 3: copy the files
- In Websites & Domains, locate the site to copy and click Website Copying.
- Select Website in Plesk.
- In Site name, choose
test.your-domain.com. - Specify how to handle the files already in the destination.
- Click OK.
This feature copies only the files in the site root. Files located elsewhere, such as those of some frameworks, must be copied separately.
Step 4: copy the database
- Go to Websites & Domains > Databases.
- Click Copy next to the site's database.
- Keep the same server in Destination database server.
- In Destination database, create a new database, for example
site_test. - Leave Create a full copy selected.
- Click OK.
Do not use the production database as the destination: tables with the same name would be replaced. Then create a user dedicated to the new database, see Create a database.
Step 5: adapt the configuration
In the files of the copy, and definitely not in those of the main site:
- Replace the database name, user and password with those of the copy.
- Replace the site address with
https://test.your-domain.com. - Turn off real sends: emails to customers, payments, scheduled tasks and webhooks.
Plesk does not update these values for you. They may also be stored in the database.
Publish the changes
The safest method is to carry your changes over to the production site after a backup. This way, you avoid overwriting recent data.
Plesk also lets you point the main domain's Document root to the copy's folder, in its hosting settings. Write down the old value so you can go back, and restore the configuration to its production values beforehand. Also remove the password protection.
Check the copy
- Open
https://test.your-domain.comin private browsing. A password must be requested. - Check that links and login stay on
test.your-domain.com. - Edit some test content, then check that it does not appear on the main site.
- Check the server's response:
curl -I https://test.your-domain.com/You should get 401 as long as the protection is active.
Troubleshooting
| Symptom | Likely cause | Solution |
|---|---|---|
| The copy redirects to the main site | The saved address is still the old one | On WordPress, use Update Site URL. Otherwise, fix the configuration and the database |
| The copy changes the main site's data | Its configuration still targets the production database | Fix the connection immediately, then check the production data |
Error establishing a database connection |
Incorrect credentials or database name | Compare wp-config.php or your configuration file with the copied database |
| The subdomain does not respond | DNS record missing or not yet propagated | Check it with dig +short test.your-domain.com |
| Certificate warning | The certificate does not cover the subdomain | Issue a certificate for this subdomain |
| Creation is impossible | Limit of sites, subdomains, databases or disk space reached | Free up resources or change plans |
| Cloning hangs or fails | Large site, problematic plugin or server limit | Clear the caches, remove old backups, then contact support if needed |
| Copy Data is canceled | The source has an older WordPress version than the target | Update the source first |