Wildcard DNS allows all subdomains to share the same set of files, which you may need for your multisite web application or if you want the subdomains to show the same content as the main site.
How to enable Wildcard DNS on cpanel server?
Use the following steps to enable wildcard DNS on cPanel server:
1) Login into WHM. 2) Click On Edit DNS Zone. 3) Choose domain to edit and click on edit button. 4) Add new record entry as under:
Record Type: A [Domain IP address] Record Data: *
5) Click on submit to add the record in DNS file.
Now, we need to modify httpd.conf file from the server end.
1) Login into SSH as root.
2) go to the /usr/local/apache/conf/ folder and edit apache configuration file
4) Find your domain entry like:
ServerName yourdomain.com ServerAlias www.yourdomain.com ServerAdmin [email protected] DocumentRoot /home/yourdoma/public_html CustomLog /usr/local/apache/domlogs/yourdomain.com combined ScriptAlias /cgi-bin/ /home/yourdoma/public_html/cgi-bin/
On the line: ServerAlias www.yourdomain.com
ServerAlias: *.yourdomain.com www.yourdomain.com
5) Save the file and exit.
[command: CTRL +:wq]
6) Restart the Apache web server by executing this command:
# service httpd restart