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?
精彩评论