简体   繁体   English

在Codeigniter 3中找不到404页面

[英]404 page not found in codeigniter 3

I am having 404 when I uploaded the codeigniter to server. 将codeigniter上传到服务器时,我遇到404。 I tried every known method and still unable to find the solution My .htaccess 我尝试了每种已知方法,但仍然找不到解决方案。

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

config.php config.php文件

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

routes.php routes.php文件

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

Controller lloyd.php 控制器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');
    }
 }

First with your uri_protocol 首先使用您的uri_protocol

Try This 尝试这个

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

Instead of 代替

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

File names must have first letter upper case on CI3 versions same with classes. 在与类相同的CI3版本上,文件名的首字母必须大写。

Lloyd.php Lloyd.php

Instead of 代替

lloyd.php lloyd.php

With base url all ways good to use / at end also. 使用基本网址也可以很好地使用/结束。

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

Make sure you have the htaccess file on the main directory of your project. 确保项目主目录中有htaccess文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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