1

I want to set expiry date for all file except the 2-3 files how to use negative filematch in apache2

<FilesMatch "^(jquery-2.1.1.min.js|home_bg.png|jquery.ui.widget.js|jquery.placeholder.js|jquery.jscrollpane.js|jquery-ui-1.10.4.custom.min.js)$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesMatch>

Right now I make this happen by adding all other to file match list.

Is there anyway to use something like FilesNotMatch

<FilesNotMatch "^(style.css|responsive.css)$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesNotMatch>

or something like

<FilesMatch "!^(style.css|responsive.css)$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesMatch>
Okky
  • 10,338
  • 15
  • 75
  • 122

2 Answers2

3

Try:

<FilesMatch "(?<!style\.css|responsive\.css)$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesMatch>
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
3

Try this:

<FilesMatch "^(?!(?:style|responsive)\.css).*$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesMatch>
zx81
  • 41,100
  • 9
  • 89
  • 105