Skip to content

Multiple Sitessubdomains for Single CI system

World Wide Web Server edited this page Jul 4, 2012 · 14 revisions

Okey you want one CI system and multiple sites with it or multiple subdomains and thats also with different/same applications .. heres how to do that... take this naming convention: [root]=http://www.yoursite.com or http://localhost or http://localhost/trysite

make some folders as follows 1- [root]/CommonCI : here you copy all system folder's content here. can remove application folder from here 2- [root]/Application_1 : This is your one application you want for any domain or for root. this directory contains the data of your application folder ie controllers, models, views etc. 3- [root]/Application_2 : This is your one application you want for any domain or for root. this directory contains the data of your application folder ie controllers, models, views etc. 4- [root]/index.php : this is the file which is available in system folder. place it here. 5- [root]/subdomain_folder : this is what you want as multiple subdomains sharing one CI. 6- [root]/subdomain_folder/index.php : the same index.php from system folder to be here.

Changes in index.php file

for [root]/index.php 1- change value of $systemfolder="CommonCI" 2- change value of $application="./Application_1" for [root]/subdomain_folder/index.php 1- change value of $systemfolder="../CommonCI" 2- change value of $application="../Application_2" or $application ="./" if you want every subdomains to have their application not common or if your subdomains contains the data of the application folder in itself.

by this relative path (from the index.php) you can use any application being common in all or in certain while different for any other.

bythis method you even can have site address as http://www.yoursite.com/yourclientsubdomains/index.php/controller/function

Enjoy

Gowrav vishwakarma www.digitalvish.com

Clone this wiki locally