View Full Version : any ideas would be helpful

11-17-2003, 06:58 PM
Hello everyone--

I have a new project that I am unsure of how to do. Here's what I need to do: when a user signs up for this site, I need to create the sub domain: http://newUser.mySite.com where newUser is the new person that signs up. I know that this is possible because I some hosting companies have very similar capabilities with in their control panels. The ISP that I am using to host the site does support sub domains too.

Also, how can I grab the url the user entered? I need to be able to set variables based on the URL

i.e. http://user.mySite.com will have user specific elements added from the DB which will be different from http://user2.mySite.com

Any ideas/help would be greatly appreciated. Thanks.

11-18-2003, 01:51 AM
Hmm. seems like Deviantart.com did it in a similar manner as what you want. All account holders have their gallery in the form of username.deviantart.com.

What DA did (my guess) was to make a folder from the root or something like www.da.com/username, then write a htaccess to redirect username.da.com

Is this what you are looking for?

As for different user specifications for account, maybe you could create different levels of user rights for them.

11-18-2003, 03:40 PM
What do you think about setting up *.site.com as a DNS pointer to site.com and then pulling out the sub domain entered to customize the page for the given user?

So, for example:


would call the pages from site.com which would pull the HOST varialbe and get the 'test' part of the URL to customize the page from the database. What do you think?

11-18-2003, 05:27 PM
this should help


$headers = getallheaders();
$domain_array = explode(".", $headers["Host"]);

while ( (list($k,$v) = each($domain_array)) && $i>2) {
$name .= " " . $v;


$page_title = ucwords($naam) . "Nice";
echo $page_title;

11-18-2003, 10:11 PM
working perfectly, thanks for the help.