how can i create subdomain names in php
hi all,
can any one tell me how can i create subdomain names for a user...when he register himself with our site...he should get the following kinda URL....
e.g
http://www.someuser.ourserver.com
now tell help me doin this on apache sweb server.....
waiting for a favourable response.....
how can i create subdomain names through asp script
Moderator: General Moderators
-
saadatshah
- Forum Newbie
- Posts: 23
- Joined: Fri Jul 05, 2002 5:50 am
- Location: Lahore
-
ShrineMaster
- Forum Newbie
- Posts: 7
- Joined: Mon May 20, 2002 5:33 am
You need to have your server set up with wildcarding for your domain...
ServerName http://www.yourdomain.com
ServerAlias yourdomain.com *.yourdomain.com
Your DNS should also support wildcard hosts.
All you need to do you parse out which user's virtual site is being viewed is parse out the $HTTP_HOST value to get the user name.
Good luck.
ServerName http://www.yourdomain.com
ServerAlias yourdomain.com *.yourdomain.com
Your DNS should also support wildcard hosts.
All you need to do you parse out which user's virtual site is being viewed is parse out the $HTTP_HOST value to get the user name.
Code: Select all
$user = str_replace(".yourdomain.com", "", $host);
if (strstr($user, ".")) {
$user = str_replace(".","",strrchr ($user, "."));
}