mod_rewrite的HTTP:Host和HTTP_HOSTvariables有什么区别吗?

以下重写条件之间是否有任何差异(微妙或其他)

RewriteCond %{HTTP_HOST} ^www.mysite.co.uk$ 

 RewriteCond %{HTTP:Host} ^www.mysite.co.uk$ 

在第二个示例中,我通过指定HTTP标头名称来访问主机名称: Host

从表面上看,它们看起来行为完全一样,如果我把重写日志logging到3 ,日志文件显示相同的活动。

%{HTTP_HOST}%{HTTP:Host}的同义词吗? 例如, %{HTTP_HOST}已经提前填充/绑定,而%{HTTP:Host}可能会导致查找惩罚?

他们是同义词。 请参阅下面的mod_rewrite文档中的引号:

关于像HTTP_HOST这样的服务器variables:

 These variables all correspond to the similarly named HTTP MIME-headers, C variables of the Apache server or struct tm fields of the Unix system. Most are documented elsewhere in the Manual or in the CGI specification. 

关于HTTP:variable

 %{HTTP:header}, where header can be any HTTP MIME-header name, can always be used to obtain the value of a header sent in the HTTP request.