标头在javascript文件上失效

cla*_*rkk 6 apache .htaccess header mod-expires

我无法让JS文件上的过期标头正常工作..它可以正常工作,例如CSS文件!?

谁能告诉我我做错了什么?:(

htaccess的

ExpiresActive on
ExpiresDefault A0
ExpiresByType image/gif A29030400
ExpiresByType image/jpeg A29030400
ExpiresByType image/png A29030400
ExpiresByType text/css A29030400
ExpiresByType text/javascript A29030400
ExpiresByType application/x-javascript A29030400
Run Code Online (Sandbox Code Playgroud)

CSS文件上的标题

Cache-Control   max-age=29030400
Connection  Keep-Alive
Date    Sun, 14 Oct 2012 12:06:45 GMT
Etag    "be-4cbcf2ad48b40"
Expires Sun, 15 Sep 2013 12:06:45 GMT
Keep-Alive  timeout=5, max=97
Server  Apache/2.4.2 (Win64) PHP/5.4.3
Run Code Online (Sandbox Code Playgroud)

JS文件上的标题

Cache-Control   max-age=0
Connection  Keep-Alive
Date    Sun, 14 Oct 2012 12:06:45 GMT
Etag    "1ad-4cc00d069f493"
Expires Sun, 14 Oct 2012 12:06:45 GMT
Keep-Alive  timeout=5, max=99
Server  Apache/2.4.2 (Win64) PHP/5.4.3
Run Code Online (Sandbox Code Playgroud)

Rob*_*ger 9

(还不能评论......)我运行以下设置,它的工作原理.

ExpiresByType text/js "access plus 1 years"
ExpiresByType text/javascript "access plus 1 years"
ExpiresByType application/javascript "access plus 1 years"
ExpiresByType application/x-javascript "access plus 1 years" 
Run Code Online (Sandbox Code Playgroud)

应该管用

干杯罗宾


Tr1*_*tan 7

尝试一个包裹ExpiresDefault在一个<filesMatch标签,而不是使用ExpiresByType:

<filesMatch "\.(js)$"> 
    ExpiresDefault A29030400 
</filesMatch>
Run Code Online (Sandbox Code Playgroud)