httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Zanev" <>
Subject [users@httpd] Subdomains Hosting
Date Mon, 22 Dec 2008 07:04:48 GMT
 Well, Hi!

I'm developing a Free Web Hosting Site. And I'm stuck, so pleease help, if
you can and if you want! :)

Every user will have the feature to add one or more subdomains to his
account. For example, if the site is called:, a user might want
to create two subdomains: sub1 and sub2. So, he should be able to use the
File Manager to manage his created subdomains and see the results at and Now, in my File System I would like
to structure the directories in the following way:


Where Superman is our username (He added the two subdomains noted above).

The problem: How to do this? I've read much about the htaccess files and I
found several solutions:

Solution 1: To Write a perl program, which connects to the database, and
selects path for a given virtualhost. The RewriteMap of the htaccess will
execute the perl program and for the subdomain sub1, it will SELECT vpath
FROM vhosts WHERE vname = "sub1". It will return: users/Superman/sub1/. The
htaccess will substitute and everything works fine.
Now, I don't like this, because if everytime we access, we
make a select query, the mysql server (yes, i'm using mysql) will die in
pain for sure.

Solution 2: Don't give the users feature to add subdomains, but when a user
is created, we created a subdomain called Now, this
will work fine, because we only need the 'superman' subdomain name to find
out where is our 'superman' subdomain path. This solution I would not like
to use.

Please, If you know how to deal with this problem, tell me. I've pointed out
two solutions, but if you know a third one....better one, please let me now.

Thank you in advance...

View raw message