I just figure this out, thanks for Google’s help.
If you want to have fake sub-domain, which do nothing but to send request to your PHP script, so you don’t need to use separate script for each sub-domain, then this might be the simplest way to do. Yup, as easy as 1, 2, and 3……. lol
Okay, so this is how:
1. Create a sub-domain and fill the name with single “*” (without quotes). For example *.mydomain.com. Specify your sub-domain directory if you want, I use “sub”, so when there is (unknown) sub-domain called, it will automatically call the script in mydomain.com/sub.
2. Then add this piece of code to retrieve the sub-domain name.
$subdomain = preg_replace(”/^([\w-]+)\..*$/”, “\\1″, $_SERVER['HTTP_HOST']);
3. Done!!! Now you can process your script easily when you know the sub-domain.






16:56
i think this is a good article.. but dunno what function of it..
bro,, you have trick to ride off the file size limitations on some server??
happy blogging
18:14
The function is, for example when you want to provide a feature to create fake sub-domain for your user. In real work example, user would like to have sub-domain such as user.domain.com, which show the user profile page, this can be done easily with fake sub-domain, using a single script to process the request…
hmm… for file size limitation, I’m not sure, but you can try to ask your hosting or split the file…