从codeigniter-2删除index.php [英] Removing index.php from codeigniter-2

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

问题描述

我在从codeigniter-2删除index.php时遇到问题。 我记得之前也使用过相同的代码&它工作正常,但在codeigniter-2上不起作用。

I am having problems removing index.php from codeigniter-2. I remember using the same code before too & it worked perfectly fine, but it is not working on codeigniter-2.

我检查了文档&也是这个问题,仍然没有帮助。

I have checked the documentation & this question too, still of no help.

我的.htaccess代码如下:

My .htaccess code is as follows:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ ./index.php/$1 [L]


推荐答案

/index.php 替换为 /site_folder_name/index.php 无处不在确保您的服务器支持mod_rewrite

您的新代码应如下:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /site_folder_name/index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /site_folder_name/index.php?/$1 [L]

RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ /site_folder_name/index.php/$1 [L]

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

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