creating a subdomain for every user
When a new user signs up, many sites create a new domain, something like newuser.example.com Does this mean that they have separate directories for every user, and copy the code base into the newly created directories and create sub domains? What is the best开发者_如何学编程 way to do this?
Refer here:
When you auto-create subdomains on user signup does it create a new website or gives appearance of a website?
Surely a DNS rule of * -> IP address
would take care of adding the subdomains quickly. Then its up to the web server to deal with the different host headers.
I would then create a new Apache directive for each different host header I needed (one for each subdomain) and have them be aliases for real website.
You can setup a wildcard domain *.yourdomain.com and handle the differences within your code if the application is pretty much the same between subdomains. Everyone comes to the same application and you just parse out the subdomain and store it in a variable which can be used to lookup different data in your database and / or render different templates / themes, etc.
I.e. subdomain_fu
精彩评论