Given that the rules specified in RFC 1034 are neither intuitive nor clearly specified, this tutorial aims to show you how to create a wildcard subdomain in cPanel.
A wildcard (catch-all) DNS record is a record in a DNS zone that will match requests for non-existent domain names.
A typical case would be if you are running a WordPress multisite blogging setup.
Using a wildcard DNS would allow WordPress multisite network users to create sub-domains upon demand & answer subdomain requests that are not assigned to any other web application.
When you create such a record, it will cause DNS lookups on domain names ending in good_doogie.com that do not exist to have MX records synthesized for them.
For example, a lookup for the MX record for tastybones.good_doogie.com would return an MX record pointing to host1.good_doogie.com.
Please note that a wildcard MX for a zone does not apply to all hosts in the zone.
A wildcard MX will apply only to names in the zone that aren't listed in the DNS at all.
According to RFC 1034, if there is a wildcard MX for *.good_doogie.com, and an A record (but no MX record) for www.good_doogie.com, the correct response to an MX request for www.good_doogie.com would be "no error, but no data".
Also, note that the new gTLDs are prohibited from publishing wildcards (or using equivalent name server mechanisms) by specification 6 of the ICANN New gTLD Base Registry agreement.
So if you are using a generic top-level domain (e.g. .guru, .club, .xyz, .online, etc), you shouldn't create a wildcard DNS record for it.
To create a wildcard DNS record in cPanel:
- Log into your cPanel.
- Navigate to Domains pane >>> Subdomains menu.
- Create a subdomain * pointing it to the necessary folder (you will need to specify the path in the field Document Root).
- Go to the Zone Editor menu.
- Double-check to ensure that there is an A record for *.good_doogie.com.com created and pointed to the server IP address (it could coincide with the IP address of your main domain (good_doogie.com) is pointed).
Once done (and depending on the DNS propagation speed of your domain's registry), you should allow at least 24-48 hours for this record to propagate across all networks.
See the URLs below for more information on this:
https://wordpress.org/support/article/configuring-wildcard-subdomains/
https://auth0.com/docs/configure/applications/wildcards-for-subdomains
https://ma.tt/2003/10/wildcard-dns-and-sub-domains/