开发者

Regex solution for www and non-www domain

I would like some help with this

Working code: regex to match xxx.domain.com

$HTTP["host"] =~ "^[^.]+\.domain\.com$" {
    evhost.path-pattern = vhosts_dir + "/company/domain.com/subdomains/%3/"
}

Www not working: (regex to match domain.com is working)

else $HTTP["host"] 开发者_如何学C=~ "^([^.]+\.)?domain\.com$" {
 evhost.path-pattern = vhosts_dir + "/company/domain.com/public/"
}

How do I get www to work with the second code example?

^(^|www.)example.com$

Thanks

Magnus


Just matching \bdomain.com$ is probably good enough, unless you worry about "bogus-domain.com" showing up. Then you could write ^(?:[^.]+\.)*domain\.com$.

Have you canonicalized to lower case?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜