forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 4
Multiple Sitessubdomains for Single CI system
Derek Jones edited this page Jul 5, 2012
·
14 revisions
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
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.
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