问题
if I like to create per user sub domain , how technically do I do this ?
for example if user XXX is registered to my site and I what to associated him the sub domain http://xxx.mydomain.com/
or http://www.mydomain.com/xxx/
what is the procedure to make it ?
回答1:
You need to setup a wildcard DNS record to catch all subdomains and send them to you web server.
Then you need to setup Apache to catch all named virtual hosts and send it to a directory.
In the directory you would set htaccess to send all requests to one script which would read the sub domain from the server variables and handle it accordingly.
回答2:
If you want mydomain.com/xxx, then that's just a folder. Some hosts will also take mydomain.com/xxx and automatically make xxx.mydomain.com point to it without needing any configuration on your part. Might want to check that this isn't already the case for you.
回答3:
How would you create the subdomain manually?
Good. Now automate it.
来源:https://stackoverflow.com/questions/4116898/how-do-i-create-personal-sub-domain-programmatically-with-php