A staging site is a copy of your live site where you can break things safely. If your site earns money or takes bookings, you should have one.
Making one
The simplest approach on our hosting is a subdomain – staging.example.com – created in cPanel, with a copy of the files and a copy of the database. Several backup and migration plugins will do the copy for you.
Three things to do to a staging site immediately
- Stop search engines indexing it. Tick the discourage-search-engines setting. A duplicate of your whole site appearing in Google helps nobody.
- Put it behind a password. Use cPanel's directory privacy so only you can reach it.
- Disable anything that contacts the outside world – payment gateways in live mode, mailing list synchronisation, order emails. A staging site that emails real customers is worse than no staging site.
Using it
Apply the update, the new plugin, or the theme change there first. Click through the parts of the site that matter, including whatever handles money. Only then repeat it on the live site.
Pushing changes back
Be careful here. Copying the staging database over the live one will overwrite everything that has happened in the meantime – new orders, new comments, new customers. For anything other than a brand-new site, make the change again on live rather than copying the database back.
Keep it current or delete it
A staging site from eight months ago tests nothing. Refresh it from live before each use, and remember it counts toward your disk and inode usage.