否定特定文件在Apache2中的匹配 [英] Negative Specific FilesMatch in Apache2

查看:92
本文介绍了否定特定文件在Apache2中的匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为除2-3个文件以外的所有文件设置有效期限,如何在apache2中使用否定文件匹配

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.

反正有没有使用FilesNotMatch之类的东西

Is there anyway to use something like FilesNotMatch

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

或类似的

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

推荐答案

尝试:

<FilesMatch "(?<!style\.css|responsive\.css)$">
  ExpiresActive on 
  ExpiresDefault "access plus 1 month"
</FilesMatch>

这篇关于否定特定文件在Apache2中的匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆