[英]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.