简体   繁体   中英

404 page not found in codeigniter 3

I am having 404 when I uploaded the codeigniter to server. 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['base_url'] = 'http://example.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';

routes.php

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

Controller 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

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.

Lloyd.php

Instead of

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.

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