简体   繁体   中英

Codeigniter 2.0 default controller for sub folder not working in server but working in localhost

I have set up a virtual host in my local machine (assume it to be http://local.he ). I have a home.php in the main 'controllers' folder. I have two subfolders inside the 'controllers' folder and they are 'admin' and 'wori' and each has a home.php file.

Per CI 2.0 structure, if I access http://local.he/module/wori then it should load home.php from 'wori' and it is working but when I did the same in the server after uploading the files it always loads from module. Even if I access something like this: http://site.com/module/wori/users , it is still loading the home.php from module.

Here is the .htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|images|js|css|static)
RewriteRule ^(.*)$ index.php/$1 [L]

Here is the routing and these two are the only executable lines in routes.php

$route['default_controller'] = "home";
$route['404_override'] = '';

When I try to access http://site.com/module/index.php/wori or http://site.com/module/index.php/wori/users then it works. I checked .htaccess and it is working for other modules in my site. I even tried this example: CodeIgniter default controller in a sub directory not working but this is still not working:

$route['wori'] = 'wori/home';

Can anyone tell me what is missing?

I followed the answer from the following url and it worked for me.

http://codeigniter.com/forums/viewthread/181149/#857629

yet would like to know why it was working normally like in the localhost.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM