Adding Subdomains in cPanel

Subdomains interface, document root setup, and multisite use cases.

Subdomains allow you to create separate sections of your website under your main domain. For example, blog.yourdomain.com or shop.yourdomain.com. This guide covers how to add subdomains in cPanel, configure document roots, and use cases for multisite setups.

What are subdomains?

A subdomain is a prefix added to your main domain name:

  • blog.yourdomain.com - blog subdomain
  • shop.yourdomain.com - ecommerce subdomain
  • mail.yourdomain.com - mail subdomain
  • www.yourdomain.com - www subdomain (most common)

Subdomains are treated as separate websites but share your main domain's hosting account.

Accessing the subdomains interface

  1. Log into cPanel
  2. In the "Domains" section, click "Subdomains"
  3. The Subdomains interface will open

Creating a subdomain

Step 1: Enter subdomain name

In the "Create a Subdomain" section:

  • Enter the subdomain prefix (e.g., "blog" for blog.yourdomain.com)
  • Do not include the full domain name
  • Use lowercase letters, numbers, and hyphens only
  • No spaces or special characters

Step 2: Select domain

Choose the domain from the dropdown:

  • Your main domain (usually pre-selected)
  • Addon domains (if you have multiple)

Step 3: Set document root

The document root is the folder where subdomain files are stored:

  • Default: public_html/subdomain
  • Custom: Enter custom path if needed
  • cPanel automatically creates the folder

Example: For blog.yourdomain.com, default document root is public_html/blog

Step 4: Create subdomain

  1. Click "Create"
  2. cPanel creates the subdomain
  3. DNS records are automatically added
  4. Folder is created in your file structure

Document root setup

Default document root

By default, cPanel creates subdomain folders in public_html:

  • public_html/blog for blog subdomain
  • public_html/shop for shop subdomain
  • Each subdomain has its own folder

Custom document root

You can set a custom document root:

  • Use different folder structure
  • Point to existing folder
  • Share folder with main domain

Example: Set blog subdomain to public_html/wordpress if WordPress is already installed there.

Best practices for document roots

  • Keep subdomains in separate folders
  • Use descriptive folder names
  • Don't overlap with main domain files
  • Organize by purpose (blog, shop, api, etc.)

Multisite use cases

1. Separate blog

Create a blog subdomain:

  • Subdomain: blog.yourdomain.com
  • Document root: public_html/blog
  • Install WordPress or other CMS
  • Keep blog separate from main site

2. Ecommerce store

Separate shopping section:

  • Subdomain: shop.yourdomain.com
  • Document root: public_html/shop
  • Install WooCommerce or Shopify
  • Isolate ecommerce from main site

3. API endpoints

Create API subdomain:

  • Subdomain: api.yourdomain.com
  • Document root: public_html/api
  • Host API files separately
  • Better organization and security

4. Testing/staging

Development subdomain:

  • Subdomain: staging.yourdomain.com
  • Document root: public_html/staging
  • Test changes before going live
  • Password protect for security

5. Mobile version

Mobile-specific subdomain:

  • Subdomain: m.yourdomain.com
  • Document root: public_html/mobile
  • Optimized mobile version
  • Redirect mobile users automatically

6. Language versions

Multilingual sites:

  • Subdomain: en.yourdomain.com (English)
  • Subdomain: es.yourdomain.com (Spanish)
  • Subdomain: fr.yourdomain.com (French)
  • Each language in separate subdomain

Managing subdomains

Viewing existing subdomains

In the Subdomains interface, you'll see:

  • List of all subdomains
  • Document root for each
  • Domain they belong to
  • Actions (Remove, Manage)

Removing subdomains

  1. Find subdomain in the list
  2. Click "Remove"
  3. Confirm deletion
  4. Note: Files in document root are NOT deleted

Important: Removing a subdomain doesn't delete files. Manually delete files if needed.

Modifying subdomains

You can change document root:

  1. Click "Manage" next to subdomain
  2. Change document root
  3. Save changes

DNS propagation

After creating a subdomain:

  • DNS records are created automatically
  • Propagation takes 24-48 hours
  • Subdomain may not work immediately
  • Use DNS checker tools to verify

Common issues and solutions

Issue 1: Subdomain not working

Causes:

  • DNS not propagated
  • Files not uploaded to document root
  • Incorrect document root path

Solutions:

  • Wait for DNS propagation
  • Check document root folder
  • Upload index.html or index.php
  • Verify DNS records

Issue 2: Subdomain shows main site

Causes:

  • Document root pointing to main domain folder
  • No files in subdomain folder

Solutions:

  • Change document root to separate folder
  • Upload files to subdomain folder
  • Create index file in subdomain folder

Best practices

  • Use descriptive subdomain names
  • Keep subdomains organized
  • Use separate folders for each subdomain
  • Document your subdomain structure
  • Remove unused subdomains

iServerGo cPanel hosting

iServerGo cPanel hosting supports unlimited subdomains:

  • Easy subdomain creation
  • Automatic DNS configuration
  • Flexible document root options
  • Multiple data centers (hong kong hosting, us web hosting, eu web hosting)
  • 24/7 support

Need help setting up subdomains? Contact iServerGo support for assistance.


Looking for fast, reliable hosting? Explore our cPanel Hosting, DirectAdmin Hosting, and US East hosting plans to match your project's needs.

← Back to all blog posts