无法从codeIgniter URL删除的index.php [英] Cannot remove index.php from CodeIgniter URL

查看:293
本文介绍了无法从codeIgniter URL删除的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目录结构是/ var / WWW / CI /下的文件夹CI的所有文件夹即,应用程序,系统。已创建在CI .htaccess文件。

My directory structure is /var/www/CI/ with all the folders viz., application, system under the folder CI. Have created a .htaccess file under CI.

以下是code在.htacess。

Following is the code in .htacess.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

不过本地主机/ CI /博客提供了404错误。任何人都可以引导,以治所在今是错的?

Still localhost/CI/blog gives 404 error. Can anyone guide as to where this rule is wrong?

推荐答案

请尝试以下

首先,请确保您设置的配置文件类似如下..

At first, make sure you set the config file like the following..

$config['index_page'] = '';

另外,还要确保的mod_rewrite 在httpd.conf文件中,之后被启用,覆盖位于项目的根文件夹不是在应用程序文件夹下面的$ C $ .htaccess文件C.。

Also make sure that mod_rewrite is enabled in the httpd.conf file and after that, overwrite your .htaccess file which is located your project root folder not in the application folder with the following code..

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

这篇关于无法从codeIgniter URL删除的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆