LAMP 上使用 Codeigniter 3 的 404,但是在 MAMP 上工作

404 with Codeigniter 3 on LAMP, but however working on MAMP

我在 CI3 上开始了一个新项目。 我用 MAMP 在我的 MB 上开发了它。一切正常!

今天下午我尝试在我的 VM 服务器上发布代码(Ubuntu 18.04,php 7.2.19)。 欢迎页面很好用,但是无法使用路由。

localhost/index.php -> good
localhost/index.php/push/ -> 404 ( still working on MAMP )

我尝试使用 .htacces,在 router.php 文件中创建一个路由,....

/application/controllers/api.php :

class Push extends REST_Controller{


public function _construct(){
....
}


public function index_post(...){
...
}

}

总是 404 NOT FOUND only only LAMP

问题是 Mac OS 不区分大小写,但是 Linux OS 区分大小写。 CodeIgniter 要求文件名和 class 名称完全匹配,并且名称中的第一个字符大写,所有其他字符均为小写。在不区分大小写的系统上,您可以忽略该约定,但在区分大小写的系统上则不能。

顺便说一句,区分大小写的是控制器、模型和库。本质上,任何定义 PHP class.

的文件