2

I have a webserver with Plesk which is set up to host my main domain, e.g. 'example.com' (and also www.example.com for that matter).

Now I want it to also support any subdomain, so whenever somebody visits whatever.example.com or random.example.com it should end up in the same main website.

In other words I want the server to not just serve example.com but also any *.example.com subdomains as the same website.

I have tried adding a wildcard DNS entry for *.example.com which points to example.com (CNAME record) or its IP address (A record) but that didn't seem to be enough.

How or what do I have to configure in order to make this work?

1

You will need to perform the actions below:

  1. You will need to add the wildcard asterisk symbol as an A record under HOST to your domain DNS records.
  2. You need to have a web host that supports wildcard redirecting… Plesk and cPanel does support this feature but some hosts disable it… you need to ask.
  3. Wait... sometimes DNS changes can take an hour to 72 hours update, this is called DNS Propagation.

It should also be noted that some domain registrars will use a dot after the record, for example GoDaddy requires a . while NameCheap does not, e.g.:

  • Host *. vs just *

If your web hosting does not support wildcard hosting then your domain registrar may have a redirecting method without the need for hosting... eg NameCheap does within the DNS management console.

  • For nr. 1 what do you mean with "under HOST"? I've added the record with the asterisk in my domain's DNS settings. And it does resolve, when I visit somethingrandom.example.com it ends up on the webserver, except it shows a default plesk landing page (saying "no website at this address"). According to my hosting provider, the server does support wildcards, but I would assume I need to setup something else to make sure Apache is aware of the wildcard as well?? (I mean something in Plesk that does this, I don't have direct access to the apache settings) – RocketNuts Feb 6 '16 at 17:31
  • HOST = NAME, VALUE, RECORD... it varies in name. If your getting a land page then the DNS is setup correctly. You need to ask your host to add ServerAlias *.domain.com to the virtual host file... and obviously the wildcard is not supported until they add that, this is basics and they should know that... – Simon Hayter Feb 6 '16 at 17:34
  • Updated my comment... – Simon Hayter Feb 6 '16 at 17:37
  • 1
    But, reading on... some Plesk setups allow you to add * as the sub domain, if you done this then you need to add a .htaccess redirect file within the root of this hosting account... – Simon Hayter Feb 6 '16 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.