Forum Discussion
theizer_91634
Nimbostratus
Apr 01, 2009multiple redirects - newb needs help
ok...trying my hand at iRules
we own domain.com and domain.net
I need my rule to redirect the following:
1. http://domain.com to https://www.domain.com
2. h...
hoolio
Cirrostratus
Apr 01, 2009Try 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
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
