[英]404 page not found in codeigniter 3
将codeigniter上传到服务器时,我遇到404。 我尝试了每种已知方法,但仍然找不到解决方案。
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';
控制器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
使用基本网址也可以很好地使用/结束。
$config['base_url'] = 'http://example.com/';
确保项目主目录中有htaccess文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.