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 currently have Apache2 configured to host wildcarded subdomains of the form *.domains.tld, where the * is unique for each client we have.

Each client has an 'admin' page that they can log into, currently at client.domain.tld/admin, that we would like to move to serve from admin.client.domain.tld.

Is it possible to serve a sub-domain to a wildcarded sub-domain? I can't seem to find anything related to this.

Thanks!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can do this with ServerAlias, as it supports wildcards.

<VirtualHost *:80>
    ServerName admin.YourStaticDomain.com
    ServerAlias admin.*
    DocumentRoot /path/to/adminsite
    UseCanonicalName Off
</VirtualHost>

This is assuming that they all share the same admin code base, and site-specific options are generated based on their login credentials.

share|improve this answer
    
Correct, thanks! –  Paul Mennega Jan 10 '13 at 22:59
    
right, but this is only half the story isnt it? What i want to know, is when doing it this way, i.e. when the asterisk isnt first, like the OP was looking for, which is what im doing, do i still use %1 to access the var? and Do i have to use ServerName, or can i leave that part out like i do on all other virtualhost entries unless needed because all this stuff is already defined in the default conf. Someting is causing problems for me, ServerAlias dev.*.ld.pvt VirtualDocumentRoot "/home/username/sites/%1" but i dont know what. –  Brian Thomas Apr 28 at 6:40
    
Brian, you are wanting a different docroot per wildcard domain? i.e: dev.google.ld.pvt points to /home/username/sites/google? –  David Houde Apr 28 at 12:22

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.