Guides › WordPress › Backups & restore

WordPress: Clone a Site to a Subdomain for Testing

Clone.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Backups and restore

A staging copy on a subdomain lets you test updates and changes without risking the live site.

1Create the subdomain2Copy the files3Copy the database4Edit wp-config.php5Change the site URLs6Block search enginesFixed? Test the site. If not, get help.
The steps in order. Work down the list and stop when the problem is solved.

Step 1: Create the subdomain

Illustration for 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

Illustration for 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

Illustration for 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

Illustration for 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

Illustration for 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

Illustration for 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

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-22.