pocockn
pocockn

Reputation: 2073

Add expires header for specific files

I am attempting to add an expires header for a specific file. It doesn't seem to be working and keeps setting it to one week. I'm not sure if it's a syntax error or the way I am trying to target the file.

Here is the code I am using in my HT Access.

  <FilesMatch "^(vendor.min.js)$">

    ExpiresByType text/javascript "access plus 4 weeks"

  </FilesMatch>

Upvotes: 1

Views: 291

Answers (1)

covener
covener

Reputation: 17896

In what context are your other Expires directives set? There are some counter-intuitive rules of how sections are merged, for example Location has higher precedence (evaluated later) than Directory/Files/FilesMatch.

I'd suggest changing the context of wherever your "1 week" rules are today.

https://httpd.apache.org/docs/2.2/sections.html

Upvotes: 1

Related Questions