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

  1. Create a subdomain, for example test: cPanel, ISPmanager, Plesk.
  2. Copy the site files to the subdomain folder — in File Manager (Copy) or over FTP.
  3. Create a new database and import a copy of the live one into it: export and import — cPanel, ISPmanager, Plesk.
  4. In the copy's settings file (wp-config.php, .env and so on), enter the new database and its user.
  5. 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_options table (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.

Questions and answers
No, as long as the copy has its own database. Do not connect the copy to the live site's database.
The copy's database still has the live site address. Replace it with the subdomain address (in WordPress — siteurl and home).
In cPanel for WordPress, push the staging copy in WordPress Manager. Manually, copy the files and database the other way, after backing up the live site first.