.htaccess中的mod_rewrite导致头文件不被应用 – 为什么?

摘自httpd.conf <VirtualHost *:80>部分(目标:为所有 JavaScript文件设置Cache-Control ):

 <LocationMatch "\.js"> Header set Cache-Control "max-age=290304000, public" </LocationMatch> 

.htaccess (Symfony PHP框架的一部分):

 Options +FollowSymLinks +ExecCGI <IfModule mod_rewrite.c> RewriteEngine On # we check if the .html version is here (caching) RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f # no, so we redirect to our front web controller RewriteRule ^(.*)$ index.php [QSA,L] </IfModule> 

现在,我用两个指向相同资源的不同URL来检查Cache-Control标头:

  1. /index.php/pt_BR/home_page.jsCache-Control设置如上所述

  2. /pt_BR/home_page.jsCache-Control与其他值

现在,为什么Cache-Control头没有设置为/pt_BR/home_page.js

请注意, 没有涉及的查询string, 并且在重写之前之后匹配<LocationMatch "\.js">

http://httpd.apache.org/docs/current/sections.html#merging

现在需要出头,我希望以后有更多的时间来解释一下这个问题。