How to add wildcard DNS to your subdomain

Wildcard subdomains are important when you want to direct all visitors to your main website irrespective of what subdomain they use to access your website through.

Adding a wildcard subdomain becomes very important when you install Wordpress-MU. This helps you to create a multiple number of sites as well as increase the number of visitors.

For instance when a visitor makes a mistake and types your domain name mistakenly he is taken to your domain due to the wildcard DNS you have enabled.

There are three ways in which you can add/enable a wild card DNS to your subdomain.
1. The easiest way to add wildcard DNS to your subdomain is to create a subdomain with *. That means the subdomain will be *.yourdomain.com (*askcrazy.com). To do this, Just go to your control panel, next go to add sub domains. The sub-domain you create should be *.domain.com
It works perfectly. Also bear in mind that some of the hosting companies will not allow this to take effect immediately. Just give it some time and your wildcard DNS will be created

2. If you have access to WHM in your cPanel, log in to WHM. Next go to Edit DNS Zone and select the domain you wish to change.

Under Add New Entries Below this Line you should fill in the fields so that they look like:

*.domain-name.com. IN A 131.4.6.1

where 131.4.6.1 is the IP of the account

3. Another way to add wildcard DNS subdomain is to edit the httpd.conf file. (For this you will need root access to the server hosting the account.)

Log in as root and open the httpd.conf file (this file is usually located in /etc/httpd/conf) with a text editor such as vim or nano. Look for VirtualHost entry for the website. You can also visit here for a clear documentation. It looks like this
ServerAlias www.yourdomain.com
ServerAdmin webmaster@yourdomain.com
DocumentRoot /home/yourdoma/public_html/drois
ServerName yourdomain.com
User yourdoma
Group yourdoma
BytesLog /usr/local/apache/domlogs/yourdomain.com-bytes_log
CustomLog /usr/local/apache/domlogs/yourdomain.com combined
ScriptAlias /cgi-bin/ /home/yourdoma/public_html/drois/cgi-bin/

The only change you make is to modify

ServerAlias www.yourdomain.com

to

ServerAlias *.yourdomain.com.

Post a Comment

Your email is never shared. Required fields are marked *

*
*