When you upgrade from shared hosting to a Virtual Private Server (VPS) or a Dedicated Server, you are introduced to WHM (Web Host Manager). While cPanel is designed for the end-user to manage a single website’s files and databases, WHM is the master control panel. It manages the server’s global architecture, allocates resources, and dictates how the DNS (Domain Name System) routes traffic across the entire machine.
Managing domain routing at the WHM level is fundamentally different from setting up a simple redirect in cPanel. In WHM, you aren’t just writing Apache .htaccess rules; you are modifying raw DNS Zone files and server-level domain forwarders. This gives you the power to manage Wildcard subdomains for SaaS applications (like WordPress Multisite), route traffic without consuming cPanel account limits, and handle massive traffic spikes with greater efficiency.
If you are an agency hosting client sites, a reseller, or a systems administrator managing your own VPS, mastering WHM’s routing capabilities is non-negotiable. This deep-dive technical guide will walk you through configuring server-level domain redirection, setting up advanced subdomains, and managing Wildcard DNS zones directly within WHM.
Understanding the WHM vs. cPanel Routing Hierarchy
Before executing any commands, you must understand how WHM processes incoming web traffic. When a browser requests a URL, it hits the server’s DNS first.
- The DNS Zone: WHM checks the DNS Zone Manager to see if an
A RecordorCNAMEexists for the requested domain or subdomain. - The Apache Virtual Host: If the DNS record points to your server’s IP, Apache then checks its
httpd.conffile to find which specific cPanel user account owns that domain and where the physical files are located.
If you attempt to create a subdomain in cPanel, but the WHM DNS Zone does not have a matching record, the site will not load. Conversely, if you create a DNS record in WHM but do not assign it to a cPanel directory, the user will hit a default server configuration page (the infamous “cgi-sys/defaultwebpage.cgi” error).
To configure routing correctly, both the DNS layer and the file directory layer must synchronize.
Step 1: Configuring Server-Level Domain Forwarding in WHM
Most users assume they need to create a full cPanel account just to redirect an old domain to a new one. This wastes server resources and clutters your WHM interface. WHM includes a native, lightweight tool specifically for redirecting domains that do not require email accounts or file storage.
This feature is called Setup/Edit Domain Forwarding. It allows you to redirect incoming traffic at the DNS and Apache level without tying up a cPanel license.
Prerequisites for WHM Forwarding
For this to work, the domain you are forwarding must not be attached to an existing cPanel account, and its nameservers must be pointing to your WHM server.
Execution Steps
- Log into your WHM root (or reseller) dashboard.
- In the top-left search bar, type Domain Forwarding and select Setup/Edit Domain Forwarding under the DNS Functions category.
- Click the button labeled Click Here to Install a Domain Forwarder. (If it is already installed, you will see a list of domains).
- Enter the domain you want to forward in the Domain column (e.g.,
old-techtrailhub.com). - Enter the destination URL in the Redacts to column (e.g.,
[https://techtrailhub.com](https://techtrailhub.com)). - Click Save.
Behind the scenes, WHM automatically generates a lightweight DNS zone and configures a server-level HTTP 301 (Permanent) redirect in Apache. This method is exceptionally fast because the server doesn’t have to load a user’s environment or parse PHP to execute the redirect.
Step 2: Creating and Managing Subdomains via WHM
A common point of confusion for new server admins is finding the “Create Subdomain” button in WHM. It does not exist.
WHM manages accounts and DNS, not individual folders. To create a standard subdomain (like shop.techtrailhub.com) that has its own directory for files, you must inject it into the specific cPanel account that owns the root domain. However, as the server admin, you do this without needing the user’s password.
- In the WHM search bar, type List Accounts.
- Locate the root domain (e.g.,
techtrailhub.com) in the list. - Click the orange cP logo next to the domain name. This instantly logs you into their cPanel account via a secure root backdoor.
- Once inside cPanel, navigate to Domains.
- Click Create A New Domain.
- Enter the full subdomain (e.g.,
shop.techtrailhub.com). - Ensure the box for Share document root is unchecked so that the subdomain gets its own isolated folder (usually
public_html/shop). - Click Submit.
This action does two things simultaneously: It creates the document root folder for the files, and it automatically updates the WHM DNS Zone with the correct A Record pointing to the server’s IP address.
Step 3: Configuring Wildcard Subdomains in the DNS Zone Manager
A Wildcard Subdomain is an advanced configuration that routes any non-existent subdomain (e.g., anything.techtrailhub.com) to a specific directory. This is the foundational technology behind WordPress Multisite (WPMU) networks and SaaS platforms where users automatically get their own subdomain upon sign-up (like user1.yoursite.com).
To achieve this, you must bypass the standard cPanel tools and edit the raw DNS records directly in WHM.
Part 1: Modifying the DNS Zone
- Log into WHM and search for DNS Zone Manager.
- Click on DNS Zone Manager under the DNS Functions section.
- Locate your target domain (
techtrailhub.com) and click Manage. - Click the + Add Record button at the top right.
- Configure the record as follows:
Name: Enter a single asterisk * (This denotes the wildcard).
TTL: Leave as default (usually 14400).
Type: Select A.
Record: Enter your server’s exact, dedicated IPv4 address.
- Click Save Record.
Now, if someone types random.techtrailhub.com, the DNS knows to send them to your server. But the Apache web server doesn’t know which folder to serve. We must fix that next.
Part 2: Configuring the Apache Wildcard Alias
You now need to tell cPanel/Apache to accept this wildcard traffic and route it to the main public_html directory so your SaaS application or WordPress Multisite script can process the URL dynamically.
- Navigate to the user’s cPanel account (using the List Accounts > cP icon method from Step 2).
- Go to Domains and click Create A New Domain.
- In the domain field, enter
*.techtrailhub.com. - Check the box for Share document root (/public_html). (This is crucial. The wildcard must point to the root installation of your application so your software’s internal router can take over).
- Click Submit.
Your server is now successfully configured to handle dynamic, unlimited wildcard subdomains on the fly.
Step 4: Troubleshooting Subdomain SSL/TLS Failures
When you create a new subdomain or a wildcard subdomain, the browser will likely throw an SSL error (“Your connection is not private”) for the first hour. This occurs because the new routing exists, but the server’s AutoSSL mechanism hasn’t yet secured it.
AutoSSL (typically powered by Let’s Encrypt or Sectigo in WHM) runs on a cron job. If you just created a subdomain, you don’t want to wait hours for the SSL to generate. You can force the process directly in WHM.
- In the WHM search bar, type AutoSSL and select Manage AutoSSL.
- Click on the Manage Users tab.
- Search for the cPanel username associated with your domain.
- Click the Check “username” button.
WHM will immediately query the Certificate Authority, verify the DNS routing of your new subdomains, and install the SSL certificates. You can monitor the live progress by switching to the Logs tab and clicking Refresh. Once the log confirms successful installation, clear your browser cache, and your new subdomain will load securely over HTTPS.
Frequently Asked Questions
1. Can I redirect a domain in WHM to a specific subpage instead of the homepage?
Yes. When using the WHM Setup/Edit Domain Forwarding tool, you are not restricted to root domains. In the “Redacts to” column, you can input a deep link, such as [https://techtrailhub.com/category/server-management/](https://techtrailhub.com/category/server-management/), and all traffic will be pushed to that exact URL via a 301 permanent redirect.
2. Why is my Wildcard subdomain showing the default cPanel holding page?
This happens when Part 1 (The DNS Zone ‘A’ Record) is completed, but Part 2 (The cPanel Domain Alias) is missing. The server’s IP is receiving the traffic, but Apache doesn’t know which virtual host directory to map it to, so it falls back to the server’s default skeleton page. Ensure you add *.yourdomain.com in the cPanel domains section.
3. How long does it take for a WHM DNS Zone change to take effect?
If you are adding a new subdomain or wildcard, the change is usually instantaneous for you, but can take up to 4 hours to propagate globally. If you are modifying an existing record, the time it takes depends on your TTL (Time to Live) setting. A standard TTL of 14400 means it will take roughly 4 hours for ISPs worldwide to drop the old cached routing and recognize the new WHM configuration.
Sources and References
- cPanel & WHM Official Documentation: Setup/Edit Domain Forwarding.
- cPanel Knowledge Base: How to create a Wildcard Subdomain.
- Apache HTTP Server Project: VirtualHost Examples and Routing.



