Creating a staging site manually
Creating a staging site
A staging site is a safe copy of your live site where you can test changes, updates, or new features without risking downtime or breaking your main site. It allows you to check plugin/theme updates, try out custom code, or redesign your site before deploying those changes live.
This guide walks you through setting up a manual staging site in cPanel. The process involves creating a subdomain, copying your site files, duplicating your database, and updating the site to use the new staging environment.
We’ll be staging a WordPress site in this guide, but the process is the same for any website — just update the configuration files to match your specific application.
Follow the steps in the order given. In particular, do not open the staging site in your browser until you have finished the Update WordPress Site Links section — until then it still points at your live database.
Create a Subdomain
- Log in to cPanel.
- Go to Domains → Domains.
- Click Create A New Domain.
- Enter your staging URL (e.g.
staging.example.co.uk). - Untick Share document root so the subdomain has its own folder.
- Click Submit.
- cPanel will set up a folder, usually
/staging.example.co.uk
Copy Your Website Files
Option A: cPanel File Manager
- Open File Manager.
- Go to your live site folder (Usually
/public_html/). - In Settings (top right), tick Show Hidden Files (dotfiles) first - otherwise
.htaccessis not copied and your staging site's pages will all return 404. - Select all files → Copy → choose the staging folder (
/staging.example.co.uk).
Option B: FTP Client
- Connect via FTP.
- Download all files from
public_html. - Upload them to
/staging.example.co.uk.
Export the Database
- In cPanel, open phpMyAdmin.
- Select your live site’s database from the left menu.
- Click Export at the top → Quick → SQL → Go.
Create a New Database
- In cPanel, go to MySQL® Database Wizard.
- Enter a name for the staging database (e.g.
stagingdb). - Create a new database user (e.g.
staginguser) with a strong password. - Assign the user to the database with All Privileges.
- Note down the database name, username, and password — you’ll need them.
Import the Database
- In cPanel, open phpMyAdmin.
- Select the new staging database.
- Click Import, upload your
.sqlfile, then click Go.
Update wp-config.php
- Open
/staging.example.co.uk/wp-config.phpin File Manager. - Update the database settings:
define('DB_NAME', 'user_stagingdb');
define('DB_USER', 'user_staginguser');
define('DB_PASSWORD', 'yourpassword');
define('DB_HOST', 'localhost');- Save the file.
Update WordPress Site Links
Do these in order. Until step 1 is done, the staging copy still believes it is the live site, and opening it in a browser will send you to your live admin instead.
- In phpMyAdmin, open the staging database and find the
optionstable (it will have your install's table prefix in front of it -wp_optionsby default, but installers often use something else). - Change the
siteurlandhomevalues to your staging URL. Includehttps://and do not put a slash on the end - for examplehttps://staging.example.co.uk. - Now log in at
staging.example.co.uk/wp-adminand install Better Search Replace. - Search for your full live URL and replace it with the full staging URL -
https://example.co.uk→https://staging.example.co.uk. Do not search for the bare domain: it would match the staging URL you just set and producestaging.staging.example.co.uk, and it would rewrite every email address on the domain as well. - Run it as a dry run first, check the number of changes looks sensible, then run it for real. Our guide to updating WordPress URLs covers this step in more detail.
Keep the staging site out of Google
Your staging site is on a public address, and left alone search engines will index it alongside your real site. In the staging site's admin, go to Settings → Reading and tick Discourage search engines from indexing this site.
Remove the staging site when you have finished
Once your changes are on the live site, take the staging copy down rather than leaving it in place. It is a complete WordPress install on a public address, and it stops receiving updates the moment you stop using it - so it becomes an unpatched way into the same hosting account your live site is on. Nothing lists it for you either, because you built it by hand rather than through an installer.
There are three parts to clear up:
- Delete the staging folder (
/staging.example.co.uk) in File Manager. - Remove the subdomain under Domains.
- Delete the staging database and its database user in MySQL Databases - the database user is easy to miss and is a live login if it is left behind.