Basically, lets say i have a webserver and i resell hosting specifically for local churches.

i have 5 churches as clients, i have a simple CMS made for them they are equal copies of the same files, for each website i install the CMS , database and the website, i think it's a waste of resources.

i would like to know if i can do the following, afaik most webhosts have the following structure:

  • A main directory (home)
    • www.church1.com (church1)
    • www.church2.com (church2)
    • www.church3.com (church3)
    • www.church4.com (church4)
    • www.church5.com (church5)

basically i want the CMS to be on the Home directory, and each one of the Churches (clients) would only have a Config file, a Database ant the template regarding their websites.

so the system source code would be shared, but the website design and the database files would be completelly separated.

i'm not a webhosting or a development expert, but i know my way around, i'm sorry if the question is too basic, i'm having a hard time finding if this is possible.

EDIT: I Think Rudu's reference pretty much solved my problem!

Comments

You can certainly do this but are you looking for a pre-built CMS that can do this for you or are you looking to re-engineer your own to have this capability? Please provide more information.

Written by Jarrod

Similar to How do I run multiple websites on the same server with the same code base in PHP?

Written by Rudu

Look for information Regarding Multi Tenant Architecture. It is entirely possible, and not that hard. But you need to code your CMS to handle this. Basically you alias all of the domains into the same homedirectory, and then your code can use the HTTP HOST header to determine which site/content to show, how to scope your DB queries etc..

Written by Doon

@Jarrod i'm looking for a way to make my own software , but i you can point me some opensource software that does this i'm open to learn as much as i can :)

Written by Johny Smith

@Rudu thank you i'm already reading on this one , iknew someone have asked this before!

Written by Johny Smith

Joomla is capable of doing this using an extension, but does not natively support a multi-site architecture. You could look into using it - it will give you most of the CMS capabilities you're looking for (probably).

Written by Jarrod

Accepted Answer

Since you are building it yourself, put the include files (application logic) in a folder or include path that is accessible to all the domains. Then you can put your template files, images and stylesheets in the individual domain folders. If you are database driven you can check the domain $_SERVER['HTTP_HOST'] and load results from a certain table or database based off of that. You really can go a lot of different directions here if you are building it yourself.

Written by Josh
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki