Wildcard subdomains are used to redirect visitors to the “main” website even if they are trying to access a different subdomain. This is also useful if visitors mistype the www portion (e.g., ww.yourdomain.com).
Another situation in which wildcard subdomains are especially required is when using WordPress Network (formerly known as WordPress Multisite or WPMU) and wish for user’s blogs to look like user.yourdomain.com.
It is possible to enable wildcard subdomains on your Jolt-hosted website in three different ways:
1. Navigate to cPanel > Subdomains and create a subdomain *.yourdomain.com. This is the simplest way.
[su_note note_color=”#ffa6bd”]Make sure that subdomain’s Document Root is public_html, otherwise this solution won’t work.[/su_note]
2. Another way is to use WHM if you have access to it. Go to ‘Edit DNS Zone’ then select the domain you would like to enable wildcard submissions from the list. Under ‘Add New Entries Below this Line’ fill in the fields so that they look like this:
* 14400 IN A 220.127.116.11
Remember to replace 18.104.22.168 with your actual server IP.
3. The third way you can enable wildcard submissions is to edit httpd.conf (Apache configuration file) directly. Keep in mind that in order to do this, you will need SSH root access.
[su_note note_color=”#ffa6bd”]Don’t use this method on servers with cPanel. At some point all changes you make will be overwritten by cPanel/WHM[/su_note]
Log in as root and access the httpd.conf file, usually located in /etc/httpd/conf. However, the path may be different depending on your Linux distro.
Locate the VirtualHost entry for the domain name you wish to enable wildcard subdomains. This is how it will look like:
<VirtualHost 22.214.171.124> ServerAlias www.domain.com ServerAdmin firstname.lastname@example.org DocumentRoot /home/domain/public_html/ ServerName domain.com User domain Group domain BytesLog /usr/local/apache/domlogs/domain.com-bytes_log CustomLog /usr/local/apache/domlogs/domain.com combined ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/ </VirtualHost>
When you’re finished, restart Apache. Wildcard subdomains should work for yourdomain.com straightaway.