Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a web server with quite a few domains on it. I am looking for an easy way to point specific sub-domains (webmail, phpmyadmin) on any TLD hosted on this server to a folder with the relevant systems using an Apache vhost.

So regardless of what domain, as long as someone enters phpmyadmin as a subdomain it should load the applicable folder.

I have a method to add a cname automatically for each DNS zone, but I'm struggling with Apache.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

A wildcard ServerAlias should do the trick..

<VirtualHost *:80>
    ServerName phpmyadmin-handler
    ServerAlias phpmyadmin.*
    # any and all settings needed for phpmyadmin to function..
    DocumentRoot /path/to/phpmyadmin
    <Directory /path/to/phpmyadmin>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
share|improve this answer
    
+1 for the obvious yet brilliant solution –  Mathias R. Jessen Jul 21 '12 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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