Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by George Petsagourakis )

Multiple Sitessubdomains for Single CI system

Category:Help | Category:Help -> TipsAndTricks

Okey you want one CI system and multiple sites with it or multiple subdomains and that is also with different or same applications, here is 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 : Application you want for any domain or for root.contains controllers, models, views etc. 

3- [root] / Application_2 : Another Application. you can have as many as you want.

4- [root] / index.php : this is the file which is available in system folder. place it here.

5- [root] / subdomain_folder(s) : 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

1change value of $systemfolder="CommonCI"
    
2change value of $application="./Application_1" 

for [root]/subdomain_folder/index.php

1change value of $systemfolder="../CommonCI"
    
2change 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.

with this method you even can have site address as

http://www.yoursite.com/yourclientsubdomains/index.php/controller/function 

Enjoy

Gowrav vishwakarma
www.digitalvish.com

Categories: