[英]Why am I getting 404 errors in CodeIgniter?
I can't understand why I'm getting 404 errors in CodeIgniter. 我无法理解为什么我在CodeIgniter中遇到404错误。
My default controller works perfectly: 我的默认控制器完美运行:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function index()
{
$this->load->view('home');
}
}
But my other controller is not working (I get a 404 when I try to access its URL): 但我的其他控制器无法正常工作(当我尝试访问其URL时,我得到404):
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Add extends CI_Controller {
public function index()
{
$this->load->view('add');
}
}
Here's some other helpful information: 这是其他一些有用的信息:
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
$config['base_url'] = '';
$route['default_controller'] = "home";
$route['404_override'] = '';
.htaccess : .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
I'm working on localhost and all the other controllers from my other applications are working perfectly. 我在localhost上工作,其他应用程序中的所有其他控制器运行正常。 This is the 1st time I have this problem.
这是我第一次遇到这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.