I found the official document quite confusing for folder structure about creating multiple application on single base folder of CI (CodeIgniter).
Here: Managing your Applications
Let say i have a base folder /ci
under web root directory /www
so my project folder structure is
/www/ci
Now according to the mentioned tutorial in above link, if i create myapp1
sub-folder under /application
folder of ci
will be
/ci/application/myapp1
main index.php path: /ci/index.php
myapp1/ folder structure: (below)
In official tutorial link, they have mentioned /applications
instead /application
to confuse us more
/config
/controllers
/libraries
/models
/views
Now if i update $application_folder
the main index.php file /ci/index.php
to point to this application folder will be
$application_folder = 'application/myapp1';
I can access it using route
Question:1 But it will no longer be able to use the main application folder /ci/application or if i create new application myapp2 sub-folder inside application folder, then how to access it?
Question:2 According to documentation:
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.
But the million$ question is where to put those own index.php
files?
Note: I am not asking about the 2nd method of having separate new application folders parallel with main application folder. I have already successfully implemented it.
Use following structure:/www/ci1
directory for 1st site/www/ci2
directory for 2nd site
Both ci1
and ci2
will be same structure and will contain index.php file. under ci1
and ci2
structure will be as follow:
/config
/controllers
/libraries
/models
/views
index.php
and system
the directory is /www/system
.
Now change:
$system_path = 'system'
to $system_path = '../system'
in both index.php
And you are done. You can access both site ci1
and ci2
. if you want ci3
,ci4
, ...
cin
you can just create a new folder and change in index.php