December 24, 2014

December 24, 2014
In this article, we are going to discuss about How to run multiple websites from a single CodeIgniter (CI) install. CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks

Each CodeIgniter website have a different "application" folder. But all are using the same "System" folder.

Take the application folder out from the system folder and make an additional copies based on the number of sites your need to create. For example, if you want to create 3 sites then, create the application folder names like "application_site1, application_site2, application_site3".

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.


Post a Comment