Forum Discussion
ukstin
Nimbostratus
Jun 09, 2008conditional redirect (404)
Hi people,
I´m trying to wrote a i-rule to redirect a 404 error based on the url. The i-rule I made is this one:
when HTTP_REQUEST {
set host [HTTP::host]
set url [HTTP::uri] ...
The_Bhattman
Nimbostratus
Jun 09, 2008Looks like the variable can't be used in another part of the irule.
have you tried the following
when HTTP_REQUEST {
set ::host [HTTP::host]
set ::url [HTTP::uri]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404 } {
if { $::host contains "abcd" } {
HTTP::redirect "http://abcd.otherdomain.com/$::url"
} elseif { $::host contains "efg" } {
HTTP::redirect "http://efg.otherdomain.com/$::url"
} else {
HTTP::redirect "http://anotherone.com/xyz.html"
}
}
}
If you noticed I am changing your variable from local to global. I have not tested this, but give that a shot.
CB
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