1

In the past I had the following config on Lighted that would allow me to redirect some secondary domains I own to my primary domain.

$HTTP["host"] =~ "superdomain\.net|superdomain\.eu" {
    url.redirect = ( "^/(.*)" => "http://mything.com/" )
}

This works fine. If someone tries to go to superdomain.net he'll be redirected to http://mything.com also keeping full URL query.

However, today I was trying to setup the sub-domain webmail.superdomain.net and Lighted matches webmail.superdomain.net on the rule before and redirects the user to http://mything.com.

The config for the subdomain was:

$HTTP["host"] == "webmail.superdomain.net" {
    var.domain = "webmail.superdomain.net"
    include "/var/webconfig/config/template/domain-generic.conf"
}

I place that rule before the other one but still no luck. Is there a way I can change the first rule to only match a domain and not subdomains?

Thank you.

TCB13
  • 1,166
  • 1
  • 14
  • 34

1 Answers1

1

I just found the answer! My redirect rule should be:

$HTTP["host"] =~ "^superdomain\.net$|^superdomain\.eu$" {
    url.redirect = ( "^/(.*)" => "http://mything.com/" )
}

Added ^ at the begging of each domain and $ at the end to specify the start and end of the string to match. This way subdomains aren't matched.

TCB13
  • 1,166
  • 1
  • 14
  • 34