Apache: ExpiresByType per directory

.htaccessapache-2.2directory

I have a folder with javascript files that should expire faster than the normal scripts.

Is it possible to let files expire per directory using Apache 2 other than .htaccess?

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/javascript "access plus 60 minutes"
</IfModule>

Best Answer

According to the documentation you can put these directives into a <Directory> tag in your apache configuration: mod_expires#ExpiresActive

For example like this:

<Directory /var/www/js/expire_fast>
  <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/javascript "access plus 60 minutes"
  </IfModule>
</Directory>