Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter Run multiple application

I m not having luck working with two applications (admin and client) with same installation of the codeigniter.

I referred to many tutorials and did

  • I created subfolder "admin" inside application folder and cut and pasted all subdirectories into it.
  • I copied and pasted admin folder inside application folder and renamed it "client"

  • and in main index.php I set application folder path to "application/admin". But this works only for admin section, and to run client I have to change application folder path again in index.php. This way I cannot run both admin and client simultaneously.

Please help me out.

Thanks

like image 729
Sharmila Avatar asked Dec 06 '12 12:12

Sharmila


2 Answers

You can find the following solution helpful:

1.Create a folder 'admin' in the root directory of CodeIgniter.

2.Copy the 'index.php' file inside 'admin' folder.

3.Change the following variables of the 'index.php' file inside 'admin' folder

$system_path = '../system';
$application_folder = '../application/admin';

4.Create a '.htaccess' file inside 'admin' folder and use the following code:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

5.Set the $config['base_url'] to 'your url/admin' inside 'application/admin/config/config.php' and autoload 'url' helper.

6.Now you can access the admin panel using 'your url/admin'.

7.Follow the same procedure for 'client'.

like image 190
Rivnat Avatar answered Sep 30 '22 08:09

Rivnat


From the codeigniter documentation:

Note: Each of your applications will need its own index.php file which calls the desired application. The index.php file can be named anything you want.

http://ellislab.com/codeigniter/user-guide/general/managing_apps.html

like image 43
pouer Avatar answered Sep 30 '22 09:09

pouer