CI在ngnix的配置

CI的访问路径是酱紫的:

http://localhost/index.php/cname/mname

其中cname为controller的名称,mname为method的名称

但是nginx会把index.php当成一个目录解析,网上很多教程要该nginx的rewrite来适配ci的path_info路径

改了很多都不成功。。。

看看ci的config.php中:

$config['allow_get_array']        = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger']    = 'c';
$config['function_trigger']        = 'm';
$config['directory_trigger']    = 'd'; // experimental not currently in use

第二行的值为false,也就是默认关闭了query_string这种方式的访问,也即:

http://localhost/index.php?c=cname&m=mname

把它改成TRUE即可快速解决问题

如果要使用path_info的访问方式可以参见:

这篇文章

原文地址:https://www.cnblogs.com/savokiss/p/4363439.html