Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any difference (subtle or otherwise) between the following rewrite conditions:

RewriteCond %{HTTP_HOST} ^$ 


RewriteCond %{HTTP:Host} ^$ 

In the second example I access the host name by specifying the HTTP header name: Host.

On the surface they both appear to behave exactly the same and if I turn up rewrite logging to 3 the log file shows identical activity.

Is %{HTTP_HOST} just a synonym for %{HTTP:Host}? For example, is %{HTTP_HOST} already populated/bound early whilst %{HTTP:Host} might incur a lookup penalty ?

share|improve this question

They are synonyms. See quotes from mod_rewrite documentation below:

About server variables like HTTP_HOST:

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.

About 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.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.