问题
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>
回答1:
Try:
<FilesMatch "(?<!style\.css|responsive\.css)$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
</FilesMatch>
回答2:
Try this:
<FilesMatch "^(?!(?:style|responsive)\.css).*$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
</FilesMatch>
来源:https://stackoverflow.com/questions/24879759/negative-specific-filesmatch-in-apache2