无法访问除代码点燃中的默认控制器之外的任何控制器


Cannot access any controllers but the default controller in Code Ignite

在代码点火器中,我正在尝试从控制器访问一个方法,但它给了我一个 404 未找到错误。也许是 .htaccess 文件或配置有问题?

我的基本网址设置为:

$config['base_url'] = 'http://localhost/codeIgniter/';

我试图访问:

http://localhost/codeIgniter/pages/index

但它返回了 404 未找到错误。

您缺少索引.php 来自项目名称后面的 url

尝试使用此网址:

http://localhost/codeIgniter/index.php/pages/index

添加

RewriteBase /codeIgniter

到 .htaccess

试试这个:

  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} -s [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^.*$ - [NC,L]
   RewriteRule ^.*$ index.php [NC,L]

如果您使用的是代码点火器最新版本,则您使用的代码点火器版本可能存在一些问题

class class_name extends CI_Controller 

其他明智

class class_name extends Controller