对mod_expires使用异常

时间:2016-09-28 16:25:03

标签: linux apache mod-expires

像test.js这样的文件是否可能不使用mod_expires?

   <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType image/jpg "access 2 month"
    ExpiresByType image/gif "access 2 month"
    ExpiresByType image/jpeg "access 2 month"
    ExpiresByType image/png "access 2 month"
    ExpiresByType text/css "access 2 month"
    ExpiresByType application/x-javascript "access plus 2 week"
    ExpiresByType text/javascript "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType image/x-icon "access plus 12 month"
    ExpiresByType image/icon "access plus 12 month"
    ExpiresByType application/x-ico "access plus 12 month"
    ExpiresByType application/ico "access plus 12 month"
   </IfModule>

我需要每次,每小时或每天至少一次浏览器阅读test.js

1 个答案:

答案 0 :(得分:1)

我建议使用<If>语法:

<If "%{REQUEST_URI} =~ /\/test\.js/" >
   ExpiresDefault "access plus 1 hour"
</If>

这假设你正在运行Apache httpd 2.4,你应该这样做。