Hi,
the irule provided by Kai is right except the order of conditions:
if uri equals /, it never executed the
elseif { ${uri} eq "/" }
because it entered in the first condition
when HTTP_REQUEST {
set HostName [getfield [HTTP::host] "." 1 ]
if { [HTTP::uri] equals "/" } {
set uri [class lookup ${HostName} REDIRECTS]
if { ${uri} eq "/" } {
allow request to root app if selected by class lookup
return
} elseif { ${uri} ne "" } {
HTTP::respond 301 noserver Location "${uri}" Connection Close
return
} else {
HTTP::respond 301 noserver Location "https://${HostName}[HTTP::uri]" Conection Close
return
}
event disable all
TCP::close
return
}
}