linuxapachemod-expires

Use exception for mod_expires


Is it possible that a file like test.js dont use 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>

I need test.js to be read by browser every time, or every hour, or at least once a day.


Solution

  • I would suggest using the <If> syntax:

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

    This assumes that you're running Apache httpd 2.4, which you should be.