How to create a subdomain
Help centreOn this page
This guide shows how to create a subdomain, such as blog.yourdomain.co.uk, in cPanel and choose the folder its files live in.
Subdomain or subfolder?
There are two common ways to add a separate section to your site:
- Subdomain: blog.example.co.uk. This works like a separate website. It has its own folder, can run its own copy of WordPress and can look completely different from your main site.
- Subfolder: example.co.uk/blog. This is simply a folder inside your main website. It’s part of the same site and doesn’t need any setup beyond creating the folder.
If the new section is closely linked to your main site, a subfolder is usually simpler. If it’s a separate project, a test site or a different app, a subdomain keeps it apart.
Create the subdomain
Newer versions of cPanel manage subdomains from the Domains page. Older versions have a separate Subdomains page. The steps are much the same.
- Log in to cPanel. See how to log in to cPanel.
- In the Domains section, click Domains.
- Click Create A New Domain.
- Type the full subdomain, for example blog.yourdomain.co.uk.
- Untick Share document root if you see that option. This gives the subdomain its own folder.
- Check the Document Root box. cPanel suggests a folder name, such as blog.yourdomain.co.uk. You can change it if you like.
- Click Submit.
What the document root is
The document root is the folder that holds the subdomain’s files. Anything you upload there shows on the subdomain. For example, if the document root is blog.yourdomain.co.uk, a file called index.html in that folder appears at blog.yourdomain.co.uk.
You can upload files with File Manager or FTP. See how to upload files with File Manager or FTP.
Add SSL
AutoSSL issues a free Let’s Encrypt certificate for new subdomains automatically, usually within a few hours. To speed it up, see how to install a free SSL certificate.
If it doesn’t work
- The subdomain doesn’t load. If your domain uses our nameservers, the DNS record is added for you. If it uses someone else’s, add an A record for the subdomain there pointing at your hosting’s IP address.
- It shows the main website. The subdomain is sharing the main site’s folder. Change its document root on the Domains page.
- It shows a blank page or a file list. The document root is empty. Upload your files or install an app into that folder.
- There’s a security warning. The SSL certificate hasn’t been issued yet. Give AutoSSL a few hours, or run it by hand.
Good to know
To host a completely different domain name on the same plan, see how to add another domain to your hosting.
Still stuck? Open a support ticket and we’ll help.
Every plan has cPanel, free SSL, backups every six hours and free migration.