Before you start
- A hosting account with the main domain on it
- Access to the domain's DNS if it is not hosted on the same server
Step 1: Decide what the subdomain is for
If it points at another company's service — a shop builder, a help desk — it only needs a DNS record, usually a CNAME; see the A and CNAME tutorial. If it is a site on your own hosting, create it in the control panel as below.
Step 2: Create it in the control panel
In current cPanel versions, Domains → Domains → Create A New Domain, and type the full name, such as staging.yourdomain.com. Older versions have a separate Subdomains page. Untick the option to share the main domain's document root, so the subdomain gets its own folder.
Step 3: Make sure the name resolves
If the domain uses the hosting server's nameservers, the panel adds the DNS record itself. If DNS is hosted elsewhere, add an A record for the subdomain pointing at the server's IP address there.
staging A 192.0.2.10Step 4: Get it a certificate
Once the name resolves, open SSL/TLS Status and run AutoSSL for the new name rather than waiting for the next scheduled run.
Step 5: Put the site in place
Install WordPress into the new document root with the panel's installer, or upload files there. For a staging copy of an existing site, the manual move tutorial covers copying files and the database.
Step 6: Keep a staging copy out of Google
Settings → Reading → Discourage search engines asks crawlers to stay away, but it is only a request. Password-protecting the folder (Directory Privacy in cPanel) actually keeps them out, along with everyone else.
The mistake people make
Creating the subdomain in the hosting panel while the domain's DNS is managed somewhere else. The panel's record is never consulted, so the subdomain does not resolve until you add the A record at the real DNS host.
