一个很有用的apache指令SetEnvIfNoCase

http://blog.chinaunix.net/uid-20262168-id-3006647.html


说明: Sets environment variables based on attributes of the request without respect to case
语法: SetEnvIfNoCase attribute regex [!]env-variable[=value] [[!]env-variable[=value]] ...
上下文: 服务器配置, 虚拟主机, 目录, .htaccess
覆盖项: FileInfo
状态: Base
模块: mod_setenvif
兼容性: Apache 1.3 and above

The SetEnvIfNoCase is semantically identical to the SetEnvIf directive, and differs only in that the regular expression matching is performed in a case-insensitive manner. For example:
SetEnvIfNoCase Host Apache\.Org site=apache
This will cause the site environment variable to be set to "apache" if the HTTP request header field Host: was included and contained Apache.Org, apache.org, or any other combination.
 
SetEnvIfNoCase 当满足某个条件时,为变量赋值,一般结合其他指令使用。
如:
1。SetEnvIf Request_URI "/logo(.)+" local_ref=0
Allow from env=local_ref  当local_ref有值时,可以访问。
2。SetEnvIfNoCase Request_URI .js$ useless-file
CustomLog logs/hebgc.com/access.log combined env=!useless-file
当满足条件时才记录日志。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值