<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[一个很有用的apache指令SetEnvIf]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[服务器技术]]></category>
<pubDate>Tue, 14 Jul 2009 05:29:55 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	语法SetEnv env-variable value&nbsp;&nbsp;<br/><br/> <br/>语法SetEnvIf attribute regex [!]env-variable[=value] [[!]env-variable[=value]] ...&nbsp;&nbsp;<br/><br/> <br/>SetEnvIf指令根据客户端的请求属性设置环境变量。第一个参数attribute必须是下列三种类别之一：<br/>一个HTTP请求头域(参见RFC2616)；例如：Host, User-Agent, Referer, Accept-Language 。可以用一个正则表达式来进行匹配。下列请求属性之一： Remote_Host 远程主机名(若可用)Remote_Addr 远程主机IP地址Server_Addr 接收到请求的服务器IP地址(2.0.43及以后版本)Request_Method 所用的请求方法(GET, POST等等)Request_Protocol 请求所使用的协议及其版本("HTTP/0.9", "HTTP/1.0", "HTTP/1.1"等)Request_URI 在HTTP请求行中请求的资源(通常是URL中去除协议、主机以及查询字符串后剩余的部分)。列出的与该请求关联的环境变量名字中的一个。这将允许SetEnvIf指令基于预先匹配的结果进行测试。只有那些由较早的SetEnvIf[NoCase]指令定义的环境变量才可以按照这种方式测试。"较早的"意思是它们在更上层的作用域(比如全局范围)中被定义或者在同一作用域中较早出现。只有在请求的属性未能得到匹配并且attribute没有使用正则表达式的时候，环境变量才会被考虑。<br/>如：不记录192.168.7.139的访问日志<br/>首先设置环境变量 SetEnvIf Remote_Addr "192&#92;.168&#92;.7&#92;.139" dontlog<br/>使用上面设置的环境变量 <br/>CustomLog "logs/access_log" common env=!dontlog<br/><br/><br/><br/><br/><br/>SetEnvIfNoCase<br/>说明: Sets environment variables based on attributes of the request without respect to case<br/>语法: SetEnvIfNoCase attribute regex [!]env-variable[=value] [[!]env-variable[=value]] ...<br/>上下文: 服务器配置, 虚拟主机, 目录, .htaccess<br/>覆盖项: FileInfo<br/>状态: Base<br/>模块: mod_setenvif<br/>兼容性: Apache 1.3 and above <br/> <br/><br/>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:<br/>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.<br/>SetEnvIfNoCase 当满足某个条件时，为变量赋值，一般结合其他指令使用。<br/>如：<br/>1。SetEnvIf Request_URI "/logo(.)+" local_ref=0<br/>Allow from env=local_ref&nbsp;&nbsp;当local_ref有值时，可以访问。<br/>当满足条件时才记录日志。<br/> <br/><br/>Tags - <a href="http://www.dzhope.com/tags/apache/" rel="tag">apache</a> , <a href="http://www.dzhope.com/tags/%25E8%25AE%25BF%25E9%2597%25AE%25E6%2597%25A5%25E5%25BF%2597/" rel="tag">访问日志</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] 一个很有用的apache指令SetEnvIf]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>