简体   繁体   English

尝试在Codeigniter中访问索引控制器时找不到页面错误

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

In my codeigniter project, I am removing index.php extension from the URLs using htaccess file. 在我的codeigniter项目中,我正在使用htaccess文件从URL中删除index.php扩展名。 But this is giving me 但这给了我

404 (Page Not Found) Error

when trying to access pages/functions in Index controller. 尝试访问Index控制器中的页面/功能时。 I tried to load a page, http://site.org/projectname/index/language/french which gave me this error. 我试图加载一个页面, http://site.org/projectname/index/language/french ,这给了我这个错误。

My htaccess code : 我的htaccess代码:

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

Can anyone help me to resolve this? 谁能帮我解决这个问题? Thanks in advance. 提前致谢。

Try like this 这样尝试

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]

You have to remove / before index.php 您必须在index.php之前删除/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM