mod_rewrite规则记录每个请求的"Config variable ${REQUEST_URI} is not defined"



我在Apache/2.4.2-win32服务器上有以下.htaccess:

# Turn mod_rewrite on
RewriteEngine On
# Allow direct loading of files in the static directory
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?static/(.+)$ - [L]
# Send all other requests to controller
RewriteCond ${REQUEST_URI} !^/?(spf/index.php)?$
RewriteRule .* spf/index.php [L,QSA]

这很好用,完全符合我的要求。对于那些不想知道它的作用的人来说,它会通过spf/index.php发送所有请求,除非它们是针对static目录中存在的文件。

该文件位于虚拟主机的documentroot中。

通过.htaccess的每个请求都会生成以下错误:

[Wed Aug 01 14:14:16.549835 2012] [core:warn] [pid 7100:tid 1076] AH00111: Config variable ${REQUEST_URI} is not defined

这实际上并没有造成问题——每个请求都能按预期工作——但它填满了我的错误日志,我不喜欢它

根据谷歌的说法,以前没有人出现过这种错误。这就是我调试它的程度,我真的不知道下一步该去哪里。

有人知道这里发生了什么吗?

p.S.我知道这可能是一个更适合SF的问题,如果普遍认为它不属于这里,我会把它移走。

您需要用%:替换$

RewriteCond ${REQUEST_URI} !^/?(spf/index.php)?$

RewriteCond %{REQUEST_URI} !^/?(spf/index.php)?$

最新更新