[Info] How to create a wildcard subdomain?

Created:

2016-11-16 12:47:08 UTC

Modified:

2017-05-11 09:37:45 UTC

0

Was this article helpful?


Have more questions?

Submit a request

[Info] How to create a wildcard subdomain?

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 12.0 for Linux

Question

How to create one subdomain to catch all non-existent subdomains for a domain?

Answer

Note: The below solutions are for Linux only and will not work on Windows, because IIS does not support wildcard host headers.

For Plesk 10.4 and later versions:

Create a wildcard subdomain by entering "\*" for its name:

For Plesk 10.3 and earlier versions:

Create a subdomain for the domain in Plesk with a name like "zz-wildcard." It has to be the last in the subdomain list, which is ordered alphabetically, so start its name with "zz."

Add special configuration (catch-all for all subdomains) to the "vhost.conf" file of this subdomain, e.g.,  /var/www/vhosts/example.com/subdomains/zz-wildcard/conf/vhost.conf: ServerAlias *.<YOUR_DOMAIN_NAME> Rebuild Apache configuration using websrvmng utility:

# /usr/local/psa/admin/sbin/websrvmng   --reconfigure-vhost --vhost-name=<YOUR_DOMAIN_NAME>

or httpdmng utility:

# /usr/local/psa/admin/bin/httpdmng --reconfigure-domain <YOUR_DOMAIN_NAME>

Now, all nonexistent subdomain requests will to go to "zz-wildcard.example.com."

Note: it is needed to replace <YOUR\_DOMAIN\_NAME> above with the actual domain name.

Have more questions? Submit a request
Please sign in to leave a comment.