$host is a variable of the Core module.
$ host
This variable is equal to the Host line in the request header or the name of the server processing the request if the host header is not available.
This variable can have a different value from $ http_host in such cases: 1) when there is no host input header or has an empty value, $ host is equal to the value of the server_name directive; 2) when the Host value contains a port number, $ host does not include this port number. The value of $ host always has lowercase since 0.8.17.
$http_host also a variable of the same module, but you will not find it with this name, because it is defined as $http_HEADER ( ref ).
$ http_HEADER
HEADER HTTP header value when converting to lowercase and with dashes converted to underscores, for example. $ http_user_agent, $ http_referer ...;
In summary:
$http_host is always the header of an HTTP_HOST request.$host is $http_host , lowercase and without a port number (if any), unless HTTP_HOST absent or is an empty value . In this case, $host is equal to the value of the server_name directive of the server that processed the request.
glarrain Mar 14 '13 at 16:25 2013-03-14 16:25
source share