How to setup Catch-All-Domains/Wildcard subdomains

Discussion in 'Plesk HOWTOs and Tutorials' started by Mashahood, Jul 7, 2007.

  1. Mashahood

    Mashahood VPS Ltx User

    This information is being provided from one of support ticket.

    My Question:
    How do I setup Catch all domains?

    Knownhost Support Team:
    Hello,

    Catch-All Domains, commonly also referred to as wildcard subdomains, is a configuration setup in which any subdomain at your domain becomes valid. By default, only those subdomains you've created in your DNS zone, eg. ftp.piyarpoint.com, www.piyarpoint.com, etc., work, while any others you haven't created, eg. knownhost.piyarpoint.com, wouldn't work. When you enable this feature, all subdomains become valid names.

    If you want to use wildcard subdomains and point them to your website make sure you have the following:

    Make sure you have a wildcard DNS entry in Domain > DNS. You can add one as followed:
    Set the "Record Type" dropdown to "A" and click the Add button.
    In the next screen enter a * (asterisk) in the domain name field, and enter the IP address to which your subdomain needs to point.

    Next, you need to create or edit the vhost.conf file for the domain (replace any instance of domainname.com with your own domain name):
    The file is located at /var/www/vhosts/domainname.com/conf/vhost.conf, and may need to be created.
    Open it, and add the line "ServerAlias *.domainname.com".
    Now run the following commmand:
    # /usr/local/psa/admin/bin/websrvmng -a -v

    Now all you need to do is restart apache and your Catch-All domains should work. If you have any further questions, please let us know.

    Regards,
    Jeff
    KnownHost support
     
  2. Jleagle

    Jleagle New Member

    Very handy, i recently asked the support team to do this for me, as i didnt know you had to do the cPanel part.
     
  3. ppc

    ppc Moderator

    Jleagle - FYI, though the steps for doing this for CPanel might be very similar, this thread particularly explains what to do for Plesk(especially the part about creating the vhost file) ;)
     
  4. GESolar

    GESolar New Member

    You could just use PHP to parse it.
     

Share This Page