WordPress: Clone a Site to a Subdomain for Testing
Clone.
A staging copy on a subdomain lets you test updates and changes without risking the live site.
Step 1: Create the subdomain

In your hosting panel add a subdomain such as staging.yourdomain.com with its own folder.
Step 2: Copy the files

Copy all site files into the new folder. In File Manager you can compress the live site and extract it in the new folder, or use a cloning plugin.
Step 3: Copy the database

In phpMyAdmin export the live database, create a new empty database and user in the panel, and import the file.
Step 4: Edit wp-config.php

In the staging folder edit wp-config.php and change the database name, user and password to the new ones.
Step 5: Change the site URLs

Use a search-and-replace tool or WP-CLI to change https://yourdomain.com to https://staging.yourdomain.com in the database. Do not edit the database text by hand.
Step 6: Block search engines

In Settings, Reading tick Discourage search engines, and password-protect the staging site so Google does not index a copy.
Good to know
Never test payment or email features on staging with live keys. Use test mode.
Still stuck?
If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.
Related guides
- Rollback Plan: How To Undo a Change in 5 Minutes
- Restore One File or One Database Table From a Backup Without Rolling Back Everything
- phpMyAdmin Import Fails: File Too Large or Script Timed Out
- phpMyAdmin Import Fails: Time Limits and Compression Tricks