Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I am using lighttpd web server and mod_write and have a simple host match expression:

$HTTP["host"] =~ "domain\.com$" {

The problem is this is matching as well. How do I modify the expression to only match but not any subdomains such as


share|improve this question
up vote 2 down vote accepted
$HTTP["host"] =~ "^domain\.com$" {

The ^ character specifies that the start of the string must be at this position; it won't match if there's anything before domain.

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.