为什么我的RewriteCond匹配,即使模式明显不匹配?

看看我的重写日志:

  (2)使用请求的uri /bundles/astrupsspectacle/spectacle.css启动init重写引擎
 (3)将模式'^(。*)$'应用于uri'/bundles/astrupsspectacle/spectacle.css'
 (4)RewriteCond:input ='$ {REQUEST_URI}'pattern ='!^ / app \ .php'=>匹配
 (4)RewriteCond:input ='$ {REQUEST_URI}'pattern ='!^ / bundles /'=> matched
 (2)重写'/bundles/astrupsspectacle/spectacle.css' - >'/app.php/bundles/astrupsspectacle/spectacle.css'
 (2)本地path结果:/app.php/bundles/astrupsspectacle/spectacle.css
 (2)以document_root为前缀到/srv/spectacle/web/app.php/bundles/astrupsspectacle/spectacle.css
 (1)继续使用/srv/spectacle/web/app.php/bundles/astrupsspectacle/spectacle.css [确定] 

它说pattern='!^/bundles/' => matched即使它显然没有pattern='!^/bundles/' => matched 。 我的模式是:

 RewriteCond ${REQUEST_URI} !^/bundles/ 

但我也试过:

 RewriteCond ${REQUEST_URI} !^bundles/ 

乃至:

 RewriteCond ${REQUEST_URI} !^bundles 

他们都说“匹配”。 我勒个去!?

您正在使用错误的符号作为环境variables。 它应该是%而不是$ 。 所以条件应该是

 RewriteCond %{REQUEST_URI} !^/bundles/