How to Make a Copy of a Site on a Subdomain for Testing
Before updating the CMS, changing the design or a large plugin, it is convenient to test everything on a copy of the site — for example, on the subdomain test.your-domain.com. The live site stays untouched.
WordPress in cPanel — in a few clicks
Open "WordPress Manager by Softaculous", expand the site settings and choose Staging — Softaculous creates a copy on a subdomain. Changes from the copy can then be pushed to the live site. For a simple copy at another address there is Clone. Details: WordPress Manager in cPanel.
Manually — in any panel
- Create a subdomain, for example
test: cPanel, ISPmanager, Plesk. - Copy the site files to the subdomain folder — in File Manager (Copy) or over FTP.
- Create a new database and import a copy of the live one into it: export and import — cPanel, ISPmanager, Plesk.
- In the copy's settings file (
wp-config.php,.envand so on), enter the new database and its user. - Replace the site address in the copy's database with the subdomain address. In WordPress, use an address replacement plugin such as Better Search Replace, or edit the
wp_optionstable (siteurl and home).
Hide the copy from search engines, or duplicates will appear in search results: in WordPress — Settings → Reading → "Discourage search engines from indexing this site", or protect the subdomain folder with a password.
The copy uses hosting space. Delete it — the subdomain, files and database — when testing is finished.