在Codeigniter中访问索引控制器时,页面未发现错误


Page not found error when trying to access index controller in Codeigniter

在我的codeigniter项目中,我使用htaccess文件从url中删除index.php扩展名。但是这给了我

404 (Page Not Found) Error

当试图访问Index控制器中的页面/函数时

。我试图加载一个页面,http://site.org/projectname/index/language/french这给了我这个错误。

我的htaccess代码:

RewriteEngine On
RewriteBase /projectname/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
有谁能帮我解决这个问题吗?

试一下

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

必须在index.php之前移除/