Apache 将类似URL后缀的目录重写为GET参数

Apache 将类似URL后缀的目录重写为GET参数,apache,mod-rewrite,Apache,Mod Rewrite,鉴于以下设置,我想进行一次无法进行的mod_重写: 我有一个域,例如example.org,指向共享托管环境中的目录,例如example/,具有以下文件结构: example/ index.php .htaccess 现在,像example.org/test这样的URL应该重写为example.org/index.php?p=test。我得出的结论如下: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME}

鉴于以下设置,我想进行一次无法进行的mod_重写:

我有一个域,例如example.org,指向共享托管环境中的目录,例如example/,具有以下文件结构:

example/
    index.php
    .htaccess
现在,像example.org/test这样的URL应该重写为example.org/index.php?p=test。我得出的结论如下:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]+)$ index.php?p=$1 [L,QSA]
不幸的是,在Firefox中打开例如example.org/test会导致以下错误:

页面未正确重定向

Firefox检测到服务器正在以一种永远无法完成的方式重定向对此地址的请求

此问题有时可能是由于禁用或拒绝接受Cookie造成的。 但是,如果我在匹配的部分前面加上前缀,它会起作用,如下所示:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^prefix/([a-z]+)$ index.php?p=$1 [L,QSA]
然后我可以打开例如example.org/prefix/test,并使用index.php?p=test提供服务,尽管没有正确引用CSS和JavaScript等其他资源

谁能帮忙