views:

190

answers:

2

Hi!

I'm asking your opinions about my next project..

I'm planning to make website which offers services where all users would be have own subdomain (user.mydomain.com) and own website.

First I was thinking to really make real subdomain, generating automatically website code into their folder, creating own database etc..

Question #1: When I need some information from all subdomains databases in my main page (mydomain.com), how can I fetch those?

Would it be better way just use one database and dynamic code what all users are using but then re-write address like it would be subdomain (mydomain.com?user=myuser -> myuser.mydomain.com)

If someone have experience with something like what I was planning, would be nice to have tips and tricks do it right! :)

Thanks!

A: 

It will be alot of less code to maintain in you have one common codebase for all users, that just reads the domain name and uses that information.

Imagine that you discover an error in the code that was generated for one of the subdomains.

Either you would have one place to correct, or you would have 1 place + the number of users to correct.

Alexander Kjäll
A: 

You'll probably want all of the subdomains to point to the same codebase and treat the subdomain as an argument that is pulled out and identifies which instance of this application it is. You'll need a table in your db that will store information about each instance and then user accounts, user data, etc will all be tied back to a specific instance.

CRasco