Multiple Applications with One CodeIgniter Installation

Tired of managing multiple folders for different applications in CodeIgniter. Describing you how to run multiple applications with one CodeIgniter Installation. People are searching solutions to make their folder structure developer friendly in order to work better then before. After reading this tutorial you gain skill on how to run multiple applications with one code Igniter installation.
  • Front End
  • Admin Panel
  • System
  • index.php

Multiple Applications with one CodeIgniter Installation

If you want to make multiple applications and you want your site applications has it's own application folder but they will share same system folder and it's easy to manage different applications with single CodeIgniter Install.
  • Application_Site1
  • Application_Site2
  • Application_Site3
  • System
  • Index.php

Setting Folder Structure in CodeIgniter

Copy CodeIgniter Folder anywhere on the server. It doesn't need to be under a website folder. Now take out the application folder from system folder. Now your folder structure will look alike.
  • Application
  • System
  • Index.php
Make additional copies of the application folder as shown above Application_site1, Application_site2, Application_site3 etc. Depends on you how many websites 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:
like Application_site1->index.php and so on.
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 are running different Website applications which are sharing same system folder but running  different applications.
This tutorials is narrated from Tuts+ and also code implementations from CodeIgniter Documentations.

Post a Comment