How to enable wildcard subdomains for your website


Here are three ways to enable wildcard subdomains for your website:

1) The easiest way to enable wildcard subdomains is to create a subdomain *.yourdomain.com. You can do this from their cPanel > Subdomains.

You should make sure that the subdomain's Document Root is public_html.

2) Log in to WHM and go to Edit DNS Zone. Select the domain you wish to modify from the list of available websites.

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

~~~~~~~~~~~~~~
* 14400 IN A 1.2.3.4
~~~~~~~~~~~~~~
where 1.2.3.4 is the IP of the account.

3) Another way to enable wildcard subdomains is to directly edit the httpd.conf file.

Log in as root and open the httpd.conf file. Then find the VirtualHost entry for the website. It should look like:

ServerAlias www.yourdomain.com
ServerAdmin webmaster@yourdomain.com
DocumentRoot /home/yourdoma/public_html/xyz
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/joe/cgi-bin/

The only modification you need to make is change:

ServerAlias www.yourdomain.com
to
ServerAlias *.yourdomain.com

Thank you.

Comments

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress