Staging copies on cPanel — clone safely without nuking production
By HostStack Editorial · · All posts
Testing WordPress changes on a live site is one of the fastest ways to lose customers. A single bad plugin update, theme edit, or PHP version change can break a production site in seconds. Staging is how professional developers work — and with cPanel, you can set it up in 20 minutes. Here's the correct way to do it.
What is a staging site?
A staging site is an identical copy of your production WordPress site on a separate URL (usually a subdomain like staging.yourdomain.in). You test all changes there first, verify everything works, then push to production. It is blocked from Google — visitors never see it.
Step 1 — Clone WordPress to a subdomain via cPanel
- Log in to cPanel → Subdomains → create
staging.yourdomain.inpointing to/public_html/staging - Go to File Manager → navigate to
/public_html→ select all WordPress files → Copy to/public_html/staging - Go to MySQL Databases → create a new database:
user_staging→ create user → assign all privileges - Go to phpMyAdmin → select your production DB → Export → Quick → SQL
- In phpMyAdmin, select the new staging DB → Import → upload the SQL file
- In File Manager, edit
/staging/wp-config.php— update the DB name, username, and password to match your staging DB
Step 2 — Fix the WordPress URLs in the staging database
WordPress stores your domain in the database. After cloning, the staging DB still points to your production URL. Fix this with WP-CLI (if your host supports it) or the Search Replace plugin:
wp search-replace 'https://yourdomain.in' 'https://staging.yourdomain.in' --all-tables
Or install Better Search Replace plugin on the staging site → run a search for yourdomain.in → replace with staging.yourdomain.in.
Step 3 — Block Googlebot from staging
If Google indexes your staging site, you create duplicate content penalties. Two options:
Option A (recommended): In WP Admin → Settings → Reading → check "Discourage search engines from indexing this site". This adds noindex to all staging pages.
Option B (stronger): Add HTTP authentication to the staging subdomain. In cPanel → Directory Privacy → select the staging folder → enable password protection. Googlebot cannot access password-protected directories.
Step 4 — Use separate database credentials
Never point your staging wp-config.php at the production database. If you do and staging has a buggy migration or plugin that corrupts data — it corrupts production too. Always use the separate staging DB you created in Step 1.
Also: generate a new AUTH_KEY and salt for your staging wp-config.php. Get new salts from wordpress.org/secret-key/1.1/salt/ and paste them in. This prevents staging sessions from interfering with production sessions.
Pushing changes from staging to production
After verifying changes on staging, here is the safest way to push to production:
- Take a full backup of production (cPanel backup + UpdraftPlus) before touching anything
- If only theme/plugin files changed: copy only those changed files from staging to production via File Manager
- If DB changes were made (new custom tables, post types, WooCommerce settings): export the staging DB → import to production after taking a production DB backup
- Test production site immediately after push — have the backup ready to restore
Faster option: WP Staging plugin
If the manual steps above feel complex, WP Staging (free tier) automates the cloning process inside WordPress. It creates a staging copy in a subdirectory with one click and handles the URL search-replace automatically. The paid version (₹3,500/year) adds push-to-production functionality. For most Indian WordPress sites, the free tier is sufficient.