访问被禁止怎么解决! xampp 服务器的 codeigniter 错误

How to resolve Access forbidden! error in codeigniter with xampp server

我是 运行 xampp 服务器上的一个 codeigniter 项目,它与默认控制器一起工作正常,但是当我尝试访问默认控制器以外的其他内容时,它说禁止访问!您无权访问请求的对象。它要么是读保护的,要么是服务器不可读的。

我在我的 config.php 文件中做了以下更改:

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

& 这是我的 .htaccess 文件,如下所示:

RewriteEngine On
RewriteBase /http://localhost/passion/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]

提前致谢。

确保 .htaccess 应该在文件夹 passion

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

.htaccess 文件应该是这样的:

RewriteEngine On

DirectoryIndex index.php
RewriteCond  !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L,QSA]