根目录和子目录的Codeigniter mod_重写

根目录和子目录的Codeigniter mod_重写,codeigniter,.htaccess,mod-rewrite,Codeigniter,.htaccess,Mod Rewrite,我有: root/.htaccess RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [QSA,L] 它可以完美地将所有请求(文件和文件夹除外)发送到index.php。我也需要它来处理我的子文件夹。 我在子文件夹root/demos/project中有.htaccess

我有:

root/.htaccess

RewriteEngine on
RewriteBase /

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

RewriteRule ^(.*)$ index.php/$1 [QSA,L]
它可以完美地将所有请求(文件和文件夹除外)发送到index.php。我也需要它来处理我的子文件夹。
我在子文件夹
root/demos/project
中有.htaccess,其中包含:

RewriteOptions inherit
但是不起作用

我在root/.htaccess中尝试了这个

RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteRule ^demos/project/(.*)$ demos/project/index.php/$1 [QSA,L]
不起作用

这:

获取内部服务器错误“配置错误”

还有很多种方法,但我尝试过的每一种方法都是:501(服务器默认值)和404(根目录中的ci)

我在
root
demos/project
中都使用了codeigniter,我只想从这两个版本中“隐藏”index.php,如何正确地做到这一点

谢谢

RewriteEngine on
RewriteRule ^(.*)$ /demo/project/index.php?/$1 [L]
这样行吗

您也可以将另一个.htaccess放在演示/项目文件夹中

编辑:

试试这个:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /demo/project/index.php?/$1 [L]
编辑2:

如果您得到一个404未找到页面,只需在root/application/config/config.php中更改config.php,如下所示:

$config['index_page'] = "index.php";
致:


内部服务器错误
配置错误
:(仍然相同:
500内部服务器错误
。我也用similiar sintax添加了.htaccess到我的子文件夹,我尝试过的所有东西,我只得到了这些:500或404。当你得到404时,它应该可以工作。你删除了配置文件中的索引页了吗?root/application/config/config.php:
$config['index\u page']=“”
但是你得到了404页吗?那么我的第二次编辑应该可以了。如果你得到了500个错误,它无论如何也不能工作。
$config['index_page'] = "index.php";
$config['index_page'] = "";