4

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!

Unpossible
  • 143
  • 1
  • 9

1 Answers1

2

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.

David Houde
  • 3,200
  • 1
  • 16
  • 19
  • 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 '15 at 06: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 '15 at 12:22