Say I have a site hosted on example.com, now I want each of my registered user to get a personalized sub-domain, e.g Alice should normally gets alice.example.com as her sub-domain. While actually alice.example.com gets data from example.com/user/alice. How to implement this mechanism? I see lots of sites are working in this way. I wonder how they did it. Is it some kind of domain server configuration, web-server configuration, .htaccess rewrite or simply some tricks in the code?
If its redirecting, as I experimented, example.com and alice.example.com will get DIFFERENT IP addresses, if that, how rewrite works since when I request alice.example.com, the web browser takes me to a completely different site (IP address).
This has confused me for some time, I just can't figure it out myself, any help would be really appreciated.
[edit]: OK WAIT! I'm afraid I made a duplicate. Check this thread: http://stackoverflow.com/questions/586129/create-subdomains-on-the-fly-with-htaccess-php