SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Plano, TX (north of Dallas)
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 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 www.mysite.com
    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) www.group1.com, 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 www.mysite.com, that would handle creating a new group and new subdomain.

    Thank you for your help,
    Marion
    Last edited by Stevie D; Mar 27, 2012 at 15:43. Reason: Example URLs delinked

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,771
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    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.

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Plano, TX (north of Dallas)
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •