Subdomains via <virtualhost>

Right now, subdomains are done by making a DNS entry, waiting for that to resolve, then using Mod Rewrite to do the URL rewriting.

while this works as its sopposed too, its slow and using mod rewrite causes complications if i want to use rewrite rules on a sub-domain (an example is using wiki on a sub,, with rewrite rules to change index.php?title=Foo to

I understand that part of this is to make things simpler in the administration side, but a long time ago in a galaxy far far away (well, when i was at school). i wrote a simple control panel for another server that stored all domain/client info in a db and then various tools read from the db (and i used bind :slight_smile: )

I had a similar setup with the conf / conf.d directories but i also had
the conf.d had a couple files

the global.conf had global options (such as aliases for webmail, qmailadmin, etc)

the vhosts.conf file had nothing more than

this domain

namevirtualhost Ip
include conf.d/domainname/*

and so on for each domain

conf.d/domain/ that had files like

sub domains used vhost containers and i could chose any directories for my subdomain (not ~/ for

I had a simple php script that created/edited/deleted files as need be.

also, djbdns supports wildcard entries but the interworx panel does not let us use *

using * IN CNAME and <virtualhost> would allow us to use rewrite rules in subdomains AND provide us with instant sub-domains instead of waiting for dns to be reloaded from cron and then the record propogated around.


Thanks for the post, and I’ll be the first to admit that the subdomain setup is neither flexible nor optimal. It’s there to cover the “basic” case and it needs work.

Regarding the setup you propose it sounds very good and we will probably take that direction (or something similar) when we add the higher level subdomain features to the panel.

also, djbdns supports wildcard entries but the interworx panel does not let us use *

Agreed, and I’ll put a bug in the system now so this gets remidied.