Knowledge Essentials - 3Essentials Hosting

Adding wildcard DNS record

Article ID: 917

 Back to Search

Question

  • I'm looking to configure my website so that anything.mydomain.com will land the visitor on my site (mydomain.com), i.e., bob.mydomain.com or trucks.mydomain.com.  How do I do this?

Answer

  • For Plesk users:
    • Some versions of plesk support this, and some will require us to create the record for you.  To determine if your version supports it, simply attempt to create the record in the Plesk DNS area for the domain in question, specifying * for the hostname.  For example, *.mydomain.com, and set it to resolve the IP address you wish.  if you receive an error when creating it, contact support and we'll create it for you manually.   
  • For cPanel users:
    • Simply add a subdomain like you would any other subdomain in the cPanel interface, except make your subdomain * (as if to show on the screen: *.example.com), and leave the document root field empty... cpanel will automatically populate it with your domain's website root, which will look like this, after you save the change:
Subdomains Root Domain Document Root Redirection Actions
* .mydomain.com /public_html not redirected Manage Redirection Remove
othersubdomain .mydomain.com /public_html/othersubdomain not redirected Manage Redirection Remove

Note that our example here also shows another subdomain (called "othersubdomain"), which is configured to point to a subfolder... so with this configuration:

  • anything.mydomain.com will serve the same content as mydomain.com and www.mydomain.com, the files in /public_html
  • othersubdomain.mydomain.com will serve the content that's stored in /public_html/othersubdomain

If you are expecting *.yourdomain.com to then load your website, a wildcard DNS record alone will not do it.  All a wildcard DNS record will do is resolve ANYTHING.yourdomain.com to whatever IP address you specify.  So for example, if I went to http://example1.yourdomain.com, it would resolve to some IP address, and if that was the same IP address where the website for yourdomain.com was hosted, the HTTP request would indeed get sent to it.  But the webserver wouldn't find a site for "example1.yourdomain.com", so it would serve the default site on the server instead of your site...

There's no way to put a hostheader on your site that would answer to *.yourdomain.com", unless your site has a unique IP address (and all sites on our SHARED and MANAGED servers use a "shared" IP address, one IP address serving many sites.    So this leaves you with two options:

option A) you could make the site answer to example1.yourdomain.com by adding example1.yourdomain.com as a DOMAIN ALIAS to yourdomain.com... that results in a host header for example1.yourdomain.com being added to yourdomain.com.  But with this approach, it means you have to specify every option for "ANYTHING" in ANYTHING.yourdomain.com as a domain alias before it would function.  That works fine IF you had a finite list of ANYTHING.yourdomain.com combinations you intended yourdomain.com to function as.  

option B) if you truly wanted ANYTHING.yourdomain.com, for any infinite selection of ANYTHING to resolve to yourdomain.com without having to pre-specify the ANYTHING's as domain aliases, then you'd need to switch your site to a dedicated IP address. When we do that, then we can configure your site to answer to any HTTP request that comes into that IP.  That, combined with the wildcard DNS record, makes your site respond to any possible combination of ANYTHING.yourdomain.com.  There is an additional charge for dedicated IP - please contact our sales/billing team for options/pricing.
 

 
Downloads Associated With This Article
No downloads are currently associated with this article.