Forum Discussion
hooleylist
Apr 01, 2009Cirrostratus
Try wrapping the condition you're NOT'ing in parentheses:
when HTTP_REQUEST {
if { not ([string tolower [HTTP::host]] equals "www.domain.com") }{
HTTP::redirect https://www.domain.com
} else {
HTTP::redirect "https://[HTTP:host][HTTP::uri]"
}
}
Or this way:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.domain.com" }{
HTTP::redirect https://[HTTP:host][HTTP::uri]
} else {
HTTP::redirect "https://www.domain.com"
}
}
Also, because of a bug in the iRule parser in pre-v10 versions, make sure to always wrap // in double quotes. See SOL7988 for details:
SOL7988: The iRule parser may fail to correctly parse and load an iRule from the command line (Click here)
Aaron