在 codeigniter 3 中找不到 404 页面

404 page not found in codeigniter 3

当我将 codeigniter 上传到服务器时出现 404。我尝试了所有已知的方法,但仍然无法找到解决方案 我的.htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond  !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]

config.php

$config['base_url'] = 'http://example.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';

routes.php

$route['default_controller'] = 'lloyd';

控制器lloyd.php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
class Lloyd extends CI_Controller{
    public function __construct() {
        parent::__construct();
    }

    public function index()
    {       
        $theme = $this->aauth->get_system_var("theme");
        $this->load->view($theme . '/home');
    }
 }

先用你的uri_protocol

试试这个

$config['uri_protocol'] = 'REQUEST_URI';

而不是

$config['uri_protocol'] = 'QUERY_STRING';

在 CI3 版本上,文件名的首字母必须大写,与 类 相同。

Lloyd.php

而不是

lloyd.php

以 url 为基础,所有方法都很好用 / 最后。

$config['base_url'] = 'http://example.com/';

确保在项目的主目录中有 htaccess 文件。