How to Set Up and Manage Subdomains in cPanel: A Complete Guide

Subdomains are a powerful feature of the cPanel control panel that let you organize your website into distinct sections without purchasing additional domain names. Whether you’re setting up a separate blog at blog.yourdomain.com, a dedicated shop at store.yourdomain.com, or a staging environment at dev.yourdomain.com, subdomains give you the flexibility to run multiple sites under a single domain umbrella. In this guide, we’ll walk through everything you need to know about creating, managing, and troubleshooting subdomains in cPanel.

Unlike addon domains — which point to completely separate domain names — subdomains are extensions of your primary domain. They share the same DNS zone and can use the same hosting resources. This makes them ideal for organizing content or running secondary applications without the overhead of registering new domain names. Understanding how subdomains work in cPanel is essential for any site owner who wants to scale efficiently.

What Are Subdomains and How Do They Work in cPanel?

A subdomain is a prefix added to your primary domain name, separated by a dot. For example, if your primary domain is yourdomain.com, a subdomain would look like sub.yourdomain.com. In cPanel, creating a subdomain automatically creates a corresponding directory under your account’s public HTML folder and sets up the necessary DNS records to route traffic.

By default, cPanel creates a main document root for each subdomain inside the public_html directory. So the subdomain docs.yourdomain.com would point to a directory like public_html/docs. Each subdomain functions as a completely independent website — you can install WordPress on it, run a different PHP version, or protect it with a separate SSL certificate through AutoSSL.

Key technical points to understand about subdomains in cPanel:

  • Each subdomain gets its own DNS A record pointing to your server’s IP address, created automatically by cPanel
  • Subdomains can have their own document root, separate from the main website’s files
  • You can point a subdomain to a different directory outside public_html if you need more isolation
  • AutoSSL typically covers all subdomains on your account, but wildcard SSL certificates may be needed for deep subdomains

Step-by-Step Guide to Creating a Subdomain in cPanel

Creating a subdomain in cPanel takes less than a minute. Follow these steps to set up your first subdomain.

Step 1: Log into cPanel and Find the Subdomains Tool

Open your cPanel dashboard (usually https://yourdomain.com/cpanel or https://yourdomain.com:2083). In the search bar at the top, type “Subdomains” and click the tool icon when it appears. You can also find it under the Domains section of the main interface.

Step 2: Enter the Subdomain Name

In the “Subdomain” field, type the prefix you want — for example, shop. cPanel will automatically show your primary domain as the domain part. The full URL — shop.yourdomain.com — will appear beneath the input field.

Step 3: Set the Document Root (Optional)

By default, cPanel populates the “Document Root” field with public_html/shop. This is where the subdomain’s files will live. You can change this path to any directory on your account. If you want an absolute isolation layer, consider setting it to something like subdomains/shop at the root level rather than under public_html.

Step 4: Click Create

Click the “Create” button. cPanel will immediately:

  • Create the document root directory
  • Add an A record to the DNS zone file
  • Add a CNAME record for www resolution (e.g., www.shop.yourdomain.com)
  • Add the subdomain to Apache’s virtual host configuration

Your subdomain is now live and accessible at shop.yourdomain.com. If you see a default “index” page or a 403 error, that’s completely normal — it just means the document root directory is empty. Upload your files or install your application to start using it.

Managing Existing Subdomains: Redirects, Root Changes, and Removal

Once you have subdomains created, the Subdomains tool in cPanel also provides management options. Click “Manage” next to any existing subdomain to access these features.

Redirecting a Subdomain

You might want to redirect blog.yourdomain.com to yourdomain.com/blog or send visitors to an external URL. In cPanel, you can use the Redirects tool (under the Domains section) to create a 301 or 302 redirect for any subdomain. Simply choose the subdomain from the dropdown, enter the target URL, and select the redirect type. A 301 redirect is permanent and passes SEO value; a 302 redirect is temporary.

Changing the Document Root

To point a subdomain to a different directory, you’ll need to delete the subdomain and recreate it with the new document root path. There is no edit option for the document root after creation. Before doing this, back up any files in the current directory to avoid data loss.

Removing a Subdomain

To delete a subdomain, find it in the list and click the “Remove” link. cPanel will warn you that this removes the Apache virtual host entry and the DNS records. Importantly, it does not delete the files in the document root directory — those remain on your server. You can delete them manually via File Manager or FTP if they are no longer needed.

Installing SSL Certificates on Subdomains

Modern browsers require HTTPS on all websites, including subdomains. If your hosting provider supports AutoSSL through cPanel (and most do), new subdomains are typically covered automatically within a few minutes to a few hours after creation.

If your subdomain doesn’t show as secure after a reasonable wait, you can manually request an SSL certificate:

  1. Navigate to the SSL/TLS Status tool in cPanel
  2. Click “Run AutoSSL” to force a fresh check for all domains and subdomains
  3. Wait 1–2 minutes and check whether the subdomain now shows a valid certificate

For deep or wildcard subdomain setups — such as app.staging.yourdomain.com — you may need a Wildcard SSL certificate that covers *.yourdomain.com. While AutoSSL now supports wildcard certificates through Let’s Encrypt in many configurations, some hosts limit this. If you encounter SSL issues on deeply nested subdomains, contact your hosting provider to confirm wildcard SSL support.

Common Subdomain Issues and How to Fix Them

Even simple subdomain setups can run into problems. Here are the most common issues you’ll encounter and how to resolve them.

Subdomain Not Loading (DNS Propagation Delay)

When you create a subdomain, cPanel updates the DNS records immediately on the server. However, DNS changes can take anywhere from a few minutes to 48 hours to propagate across the internet. If you just created the subdomain, wait 30 minutes and try again. You can speed things up by flushing your local DNS cache (ipconfig /flushdns on Windows or sudo dscacheutil -flushcache on macOS).

“404 Not Found” or “403 Forbidden”

A 404 error means the subdomain resolves to your server, but no file exists in the document root. Upload an index.html or index.php file to the subdomain’s directory. A 403 error usually means the directory exists but lacks proper permissions. Verify that the document root directory has 755 permissions and the files inside have 644 permissions via the File Manager tool.

Subdomain Points to the Main Website

If sub.yourdomain.com shows the same content as yourdomain.com, the document root likely overlaps with the primary domain’s root. Check the subdomain’s document root path in the Subdomains tool. It should point to a dedicated folder, not to public_html itself. If it’s set correctly, clear your browser cache or test in an incognito window.

AutoSSL Fails on the Subdomain

If AutoSSL repeatedly fails for your subdomain, check whether the subdomain resolves to the correct IP address. Use a tool like ping sub.yourdomain.com in your terminal or an online DNS checker. If the IP doesn’t match your server, the DNS A record may be pointing elsewhere. Delete and recreate the subdomain in cPanel with the correct document root, which also regenerates the DNS records.

Key Takeaways

  • Subdomains in cPanel let you run multiple independent sites under one domain without buying additional domain names
  • Each subdomain gets its own document root directory, DNS records, and Apache virtual host entry — all created automatically
  • You can redirect subdomains, change their document root (by recreating), or remove them cleanly through the cPanel interface
  • AutoSSL typically covers all subdomains automatically, but deeply nested or wildcard setups may require manual attention
  • DNS propagation delays are the most common cause of subdomains not loading immediately after creation
  • Permission issues (403 errors) and empty document roots (404 errors) are easily fixed via File Manager and permission checks