Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to match a referer to a host name in my .htaccess and stumbled upon the following.

The condition reads:

RewriteCond %{HTTP_REFERER} ^https://%{HTTP_HOST}.*$

But this never matches, and the log file for mod_rewrite states this:

RewriteCond: input='https://mysite.com/test.htm' pattern='^https://%{HTTP_HOST}.*$' => not-matched

Why is the HTTP_HOST variable not getting expanded in this condition?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This is expected behavior. See here and here for details / workarounds.

share|improve this answer
    
So it appears there is no way to work around my particular issue, where I want to substitute host name into the comparison? –  SaltyNuts Jul 26 '12 at 15:00

Your Answer

 
discard

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.