Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

php - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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'.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...