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 have two sub-domains which I want to redirect to the same directory:

$HTTP["host"] =~ "sub1\.example\.com$" {
    server.document-root = "/home/adam/html/sub_domain" 
}

$HTTP["host"] =~ "sub2\.example\.com$" {
    server.document-root = "/home/adam/html/sub_domain" 
}

Naturally, I've tried:

$HTTP["host"] =~ "sub1\.example\.com$" OR $HTTP["host"] =~ "sub2\.example\.com$"{
    server.document-root = "/home/adam/html/sub_domain" 
}

But got:

2011-03-14 10:19:30: (configfile.c.855) source: /etc/lighttpd/lighttpd.conf 
    line: 199 pos: 36 parser failed somehow near here: or

This failed with OR (upper case), or and even c-style ||.

Any idea how to avoid the awkward code repetition?

This question is a copy of an unanswered post I've published in the lighttpd forum.

share|improve this question
add comment

2 Answers 2

Try -o for logical OR. Try -a for logical AND.

Also reference this page for some more operator commands in *nix.

report back and let us know if that works!

share|improve this answer
    
Does not work: 2011-03-14 14:04:05: (configfile.c.855) source: lighttpd.conf line: 200 pos: 36 parser failed somehow near here: -o –  Adam Matan Mar 14 '11 at 14:04
add comment

Why not just...?

$HTTP["host"] =~ "^sub(1|2)\.example\.com$" {
    server.document-root = "/home/adam/html/sub_domain" 
}
share|improve this answer
add comment

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.