Usually the Wildcard is used for the subdomains. This process is useful when a client wishes to redirect all his upcoming visitors to his main website, regardless of what subdomain they access your website through. This is very important as well as very useful whenever someone mistypes www for example and writes ww.yourdomainname.com.
In other words, with wildcard subdomains it won’t matter whether someone accesses your site through ww.yourdomainname.com or wwwwww.yourdomainname.com.
Here are three ways to enable wildcard subdomains for your website:
Step 1 :- The easiest way to enable wildcard subdomains is to create a subdomain on the website hosting account *.yourdomainname.com. customers can do this from their cPanel > Subdomains.
You have to make note that the subdomain’s document you are accessing is in Root which is public_html.
Step 2 :- If you are using cPanel and you have access to WHM, you can 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 22.214.171.124
where 126.96.36.199 is the IP of the account
Step 3:- There is one more way to enable the access for the wildcard subdomains is to directly edit the httpd.conf file. For this the user will need the root access to the web server hosting the account.
You have to log in as an administrator by root and open the httpd.conf file (usually this file is located in /etc/httpd/conf) with a text editor such as vim or nano. Then find the VirtualHost entry for the website.
It will look like :-
ServerAdmin [email protected]
User your domainname
CustomLog /usr/local/apache/domlogs/yourdomainname.com combined
ScriptAlias /cgi-bin/ /home/yourdoma/public_html/joe/cgi-bin/
The only changes that are required now are:
to ServerAlias *.yourdomainname.com