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.

link|improve this question

78% accept rate
feedback

1 Answer

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!

link|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
feedback

Your Answer

 
or
required, but never shown

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