Mod rewrite 在子目录上重写apache mod

Mod rewrite 在子目录上重写apache mod,mod-rewrite,apache,Mod Rewrite,Apache,当我在webroot上已经有了删除'index.php'的重写规则时,关于在子目录上重写mod的快速问题 我的.htaccess如下所示: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /

当我在webroot上已经有了删除'index.php'的重写规则时,关于在子目录上重写mod的快速问题

我的.htaccess如下所示:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
我想要实现的是以下形式:

/webroot/api/user/get/ (return a list of users)
它仍然保留主网站的基本重写规则

/webroot/members/  (display a list of users in the main applications)
非常感谢,,
Justen你的基础重写看起来很奇怪

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
删除
index.php
您需要类似以下内容:

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

例如,
index.php/foo
转到
foo
(相对重写:然后
RewriteBase
被附加到它上,变成
/foo
URL以反馈到请求管道中。)

您好,我想要的实际上是两条重写规则。。1)
如果url=/index.php,则删除“index.php”
和2)
如果url=/api/index.php,则删除“index.php”
。。不确定这是否可行,但看起来会干净得多
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^index.php/(.*) $1 [L]