Project

General

Profile

Conditional OR, AND, NOT with HTTP["host"]

Added by adamatan over 13 years ago

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 ||.

Is there any way to avoid code repetition and use compound conditions in virtual hosts?
Thanks,
Adam

PS Following your forum guidelines :
  • Ubuntu 8.04
  • lighttpd-1.4.19 (ssl), Build-Date: Mar 20 2009 18:07:36
  • Working from Chromium, but configuration failed before this stage.