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

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 test.domain.com as well. How do I modify the expression to only match http://domain.com but not any subdomains such as test.domain.com?


share|improve this question

1 Answer 1

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.