create wildcard subdomain in plesk

APPLIES TO:

  • Parallels Plesk Panel for Linux/Unix

 

Symptoms

I have a few subdomains. However, visitors are sometimes accessing nonexistent subdomains. I want to create one subdomain to catch all nonexistent subdomains for the domain.

Resolution

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/domain.com/subdomains/zz-wildcard/conf/vhost.conf:

ServerAlias *.domain.com

Rebuild Apache configuration using the websrvmng utility:

PRODUCT_ROOT_D/admin/sbin/websrvmng  -a -v

Now, all nonexistent subdomain requests have to go to "zz-wildcard.domain.com."

Leave a comment