Sunday, October 13, 2013

Running Multiple Sites in Codeigniter

it possible for you to run multiple sites from a single install of CodeIgniter. Each website will have its own application folder, but they will all share the same system folder.


ss_7


Install CodeIgniter anywhere on the server. It doesn’t need to be under a website folder. Then take the application folder out of the system folder. And make additional copies of it, as seen in the image above, for every website you want to run. You can place those application folders anywhere, like under each separate website folders.


Now copy the index.php file to the root of each website folder, and edit it as follows:


At line 26, put the full path to the system folder:




$system_folder = dirname(__FILE__) . '../codeigniter/system';

 




At line 43, put the full path to the application folder:




$application_folder = dirname(__FILE__) . '../application_site1';

 




Now you can have independent websites using separate application folders, but sharing the same system folder.


There is a similar implementation in the CodeIgniter User Guide you can read also.



Running Multiple Sites in Codeigniter

No comments:

Post a Comment