我有两个子域,我想redirect到相同的目录:
$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" }
自然,我试过了:
$HTTP["host"] =~ "sub1\.example\.com$" OR $HTTP["host"] =~ "sub2\.example\.com$"{ server.document-root = "/home/adam/html/sub_domain" }
但是得到了:
2011-03-14 10:19:30: (configfile.c.855) source: /etc/lighttpd/lighttpd.conf line: 199 pos: 36 parser failed somehow near here: or
这与OR (大写) or甚至c样式||失败 。
任何想法如何避免尴尬的代码重复?
这个问题是我在lighttpd论坛发表的一篇未回复的post的副本。
为什么不只是…?
$HTTP["host"] =~ "^sub(1|2)\.example\.com$" { server.document-root = "/home/adam/html/sub_domain" }
尝试使用逻辑或。 尝试 – 为逻辑与。
也可以参考这个页面在* nix中的一些更多的操作符命令。
报告回来,让我们知道,如果这样的作品!