only host equal http://mail.xin.com or http://mail.youxinpai.com to redirect

When client noly hit " http://mail.xin.com “or” http://mail.youxinpai.com " ,F5 redirect https://mail.xin.com/owa ,others reject or drop; I create a irule ,but it not work ,please help me check this .

The Request Target path will never match the empty string. There is always a leading slash (/), even if it is implicit. You can also revise your rule somewhat to reduce the number of expansions and repeat branches:

when HTTP_REQUEST {
    if { [HTTP::path] eq "/" } {
        switch [string tolower [HTTP::host]] {
            "mail.xin.com" -
            "mail.youxinpai.com" {
                HTTP::respond 301 Location "https://mail.xin.com/owa"
                return
            }
        }
    }
    
    reject
}

See the following recipe for an explanation on the use of

HTTP::path

vs.

HTTP::uri

and the

HTTP::respond 301

vs.

HTTP::redirect

: