Create a subdomain in cPanel
A subdomain is an address such as blog.your-domain.com, attached to your domain, that can show another site or another section. In cPanel you create it from the Domains screen.
Before you start
- You can access cPanel (see the article "Log in to cPanel").
- You have chosen the name: letters, digits and hyphens, for example
blogorshop. - Creating subdomains is a feature the host enables on the account: if the screen does not offer it, contact support.
- The main domain must already work (see the article "The public_html folder" to know where the files go).
Steps
- Open the Domains screen. In cPanel, under "Domains", click Domains (shown as Domains in French).
- Click "Create A New Domain".
- Choose "Registered Domain", the domain type used to add a domain or to create a subdomain of an existing domain.
- Enter the full name in the Domain box:
blog.your-domain.com. According to the cPanel documentation, to create a subdomain you enter the new name, a period, then the site's domain. - Choose the files folder. Two cases:
- Same content as the main domain: leave the "Share document root" box ticked. The subdomain then shows the same files. The documentation states that this setting is permanent.
- Separate content (the most common case): untick that box. cPanel then proposes a folder in Document Root (File System Location), for example
public_html/blog.your-domain.com, and the documentation recommends keeping the proposed values. This folder must be insidepublic_html.
- Click "Submit" (or "Submit and Create Another" to create more in a row).
- Upload the subdomain's files to its folder, with the File Manager or over FTP.
What about DNS?
If your domain uses the hosting's name servers, cPanel manages the DNS zone; records can be viewed in the Zone Editor (shown as Zone Editor in French). The cPanel documentation states that the subdomain is not visible immediately: DNS record changes may take two days or more to reach every name server on the Internet (see the article "DNS propagation"). If your domain is managed elsewhere, add the matching record there, with whoever manages your DNS zone.
The subdomain's certificate
According to the cPanel documentation, when the domain is created the system tries to secure it with an existing certificate. If there is none, it generates a self-signed certificate, which browsers flag as untrusted. If the host has enabled AutoSSL for the account and the server configuration allows it, an AutoSSL certificate request is added and the certificate is installed once available. Check the result in the SSL/TLS screen and, if needed, install a certificate (see "Install an SSL certificate in cPanel"). A "wildcard" certificate covers all subdomains.
Expected result
The subdomain appears in the Domains screen list with its folder, and blog.your-domain.com shows that folder's content once DNS is up to date.
If something goes wrong
- The subdomain does not open. Wait for the DNS update, then test in a private window. Check that the domain really uses the hosting's name servers.
- A default page or a file list appears. The folder is empty or has no home page (
index.htmlorindex.php). - Security warning in the browser. The certificate is missing or does not cover this name: see "Install an SSL certificate in cPanel".
- The chosen folder is refused. The documentation forbids some folders (the home folder itself,
mail,ssl,tmp,logs,.ssh,cgi-bin…) and requires a folder insidepublic_html. Keep the proposed folder. - The subdomain shows the main site. The "Share document root" box was ticked: the setting is permanent, so delete the subdomain and create it again with the box unticked.
Frequently asked questions
What is a subdomain?
It is a part of your domain with its own address, such as blog.your-domain.com, and its own folder in your space.
Is a subdomain a separate site? It can be: it has its own folder and files. For WordPress, install it in the subdomain's folder.
What is the difference with an addon domain?
An addon domain is another domain name (other-site.com); a subdomain is a name built on yours. See the article "Add an addon domain in cPanel".
Can I create as many subdomains as I want? It depends on the limits of your plan; see the plan's page.
Going further
Need a cPanel hosting space for your sites and subdomains? Discover our web hosting.