How To Create A Subdomain In cPanel
The ease of setting up subdomains is one of the most powerful features of cPanel.
With just a couple of clicks you can have a subdomain activated, with a fresh copy of WordPress, and even a valid SSL certificate.
Recently we've had some questions on how to modify these, including deleting them, so I figured I'd make a little guide to help everyone out.
Check DNS Records
Before getting started, it's important to perform a DNS Check using our free DNS Hero tool.
This allows you to make sure everything is setup correctly, so when you go to create the subdomain it'll provision as expected.
As you can see in the above screenshot we're using AppsGators's name servers (ns29.AppsGators.net and ns30.AppsGators.net) so cPanel will setup everything automatically.
If I'm checking a site hosted by a reseller, it's important to see the Reseller's name servers. If you're using a third-party DNS provider, such as Cloudflare, you'll need to follow their directions to properly add the corresponding records.
You should see no red on the report before getting started. (Important: if using Cloudflare's names servers you may see a false-positive test result, but always best to check with their support team to make sure).
How To Create A Subdomain
Once you're certain your DNS records are all set, you need to follow these simple steps to add the subdomain:
- Login to cPanel
- Navigate to the Subdomains icon
- Create the Subdomain as the screenshot above shows
The document root is the folder where all of the files will live. I recommend keeping this default as it will place all the files just above your public_html directory of your main website.
Once you click Create it may take up to 24 hours for the DNS records to fully propagate. Most of the time it only takes a few hours in the United States, but if you don't see it active right away, that's why.
You can also see this article: How To Speed Up DNS Propagation to try and speed up this process.
How To Install WordPress
If you're wanting to install WordPress on the subdomain, the easiest way is to navigate WordPress under the Softaculous apps installer in cPanel:
- Login to cPanel
- Click on WordPress under Softaculous apps
- Click Install Now
- Under "Choose Domain" select the subdomain you just created
- Continue installing WordPress per the directions provided on the screen
How To Setup SSL On Your Subdomain
If you just setup your Subdomain it's possible the SSL certificate hasn't automatically installed. For this to happen, the DNS records must be propogated so the Let's Encrypt module can verify domain identification.
If you'd like to manually try to run it, you can follow these steps:
- Login to cPanel
- Click SSL/TLS Status
- Check the box next to the red beside the subdomain (as noted in the screenshot above)
- Click Run AutoSSL
This will attempt to force run the AutoSSL module. It takes a few minutes to run, so just set and let it do its thing. If it fails, it's likely you need to wait another hour or two for the DNS to propagate. This process should be automated if waiting 24 hours or more.
How To Manually Add Files To Your Subdomain
If you don't want to install WordPress on your subdomain you can manually upload your files through an FTP program such as Transmit or Filezilla. The easiest way though is to do so through File Manager:
- Login to cPanel
- Click on File Manager (at the top)
- Navigate to your Subdomain's document root
- Click the Upload link at the top
- Upload your files
You can also manually create files by clicking + File or + Folder on the top menu. This is especially helpful if you're just wanting to create a basic HTML page.
How To Remove A Subdomain
Removing a subdomain is pretty easy, but there are a couple steps you need to take into consideration:
- Login to cPanel
- Click on Subdomains
- Click on Remove under Actions
- If you installed WordPress using Softaculous:
- Go back to the main cPanel page
- Click on WordPress under Softaculous
- Under "My Apps" click the Red X to remove
- If you manually installed your files:
- Go to the main page of cPanel
- Click on File Manager
- Navigate to the document root of the subdomain
- Delete the folder
That's it! Your subdomain has successfully been removed. It's important to remember, just deleting it inside of cPanel removes the DNS entries, but not the actual files/folders. I believe this is security setting so you don't accidentally remove wanted files.
How To Manage Your Subdomains In cPanel
I filmed a video tutorial where I cover everything mentioned above in a step-by-step manner:
If you have any questions, please feel free to ask below!