Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  Domain Name & DNS Issues  >  How to add a wildcard DNS record?
Top Scroll

How to add a wildcard DNS record?

 2 min

Wildcard DNS works in such a way, that any subdomain redirects to your primary domain.

For example, when set, anyone typing or will be redirected to

It is also used to redirect queries like to, where ww is wrongly typed.

WildCard subdomains can be set by either of the three ways:

1. Setting it from cPanel

2. Setting it from WHM

3. Setting it from httpd.conf

1. Setting it from cPanel

a. Log into your cPanel

b. Go to Subdomains

c. Add subdomain * in the box next to the field ‘Subdomain’ of your primary domain. Make sure that the Document Root is set to public_html folder.

While adding Wildcard subdomain to your Addon domain, you just need to be sure to set the Document Root to that of the Addon Domain and not the primary domain.

2. Setting it from WHM

If you have access to WHM, then you need to

a. Go to Edit DNS Zone

b. Select the required domain

c. Under Add New Entries Below this Line insert as below



NOTE: Please replace 20.x.xx.xx with the actual IP of the account.

3. Setting it from httpd.conf

 In order to use this method, you need root access to the server.

a. Login as root

b. Edit httpd.conf  (commonly located at /etc/httpd/conf) with your favorite text editor such as Vim or Nano and go to the VirtualHost entry of the domain/website.

DocumentRoot /home/mydomain/public_html
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/ combined
CustomLog /usr/local/apache/domlogs/ “%{%s}t %I .\n%{%s}t %O .”

c. The line ServerAlias is of your interest. Simply replace www with * which should look like ServerAlias *

That’s it !


For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
Claim the discount before it’s too late. Use the coupon code:
Note: Copy the coupon code and apply it on checkout.