Same Code, Multiple Sites

I am creating a site that will be for a group to organize their members/activities. I want to make this available for different groups to use, with each group having it’s own site, but using the same code. I have had subdomains on my domain, but it was it’s own website with it’s own code. I’m not sure how to “share” the code.

My domain would be [noparse]www.mysite.com[/noparse]
The first group would have group1.mysite.com
The second group would have group2.mysite.com

I’m thinking each group can have their own url; ex) [noparse]www.group1.com[/noparse], that would point to group1.mysite.com

If the code resides in directory public_html, would I need an index in public_html/group1 that would point up to public_html?

Each group would need their own database tables too. I imagine a lot of this information would need to be in configuration files/tables so that my code would get the value out of the configs to know what directories, databases, etc that it will use.

I’ve set up several phpBB boards, but again, once the code is installed & configured it is only used for that particular board - at least the way that I’ve setup. So, I can see similarities in what I want with how phpBB works, EXCEPT I don’t want to install the software for each board.

There will probably be some admin code for the [noparse]www.mysite.com[/noparse], that would handle creating a new group and new subdomain.

Thank you for your help,
Marion

Yes, something like this could easily be done using rewrites. The group name would be in the subdomain or immediately following your domain name and your script would process the request based on that identifier, all using the same code base. That would not be difficult to do at all.

Each group would not necessarily need their own database tables. That would be your decision. A field in a table could identify the group that owns the content.

Having the server answer for custom domain names is another matter entirely. I don’t think that would be too hard to do, but you are going to need to have administrative rights on the server over and above what you are going to have with your basic shared hosting account.

I am not completely understanding the response. Could you explain in more detail? What do you mean by rewrites? I’m sure it is common web development terminology, but I am new to web development; though an experienced C, C++, Java programmer.

About the individual databases - I’m just wondering if it would be “safer” for each group to have their own database. I don’t understand the intricacies of web security yet, so my thoughts do not have much basis.

Thanks!
Marion

Really there are two fundamental ways to handle this problem:

a) have a single app, which, when combined with infrastructure [eg: url rewrites] can play like a nice multi-tenant app.
b) work out a good build process to deploy multiple tenants as standalone apps.

Both have merits though (b) tends to be a better option for a few reasons – big one being it can provide a better customization per tenant platform.