Forum Discussion
The_Y
Jun 25, 2019Cirrus
Mohamed,
if you are looking for a static redirect then this should work
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] ends_with "example.com"} {
HTTP::redirect "https://example.com/xyz"
}
}
- HamishJun 30, 2019Cirrocumulus
If www.example.com and example.com are the same VS, then this is the source of your looped redirect. You hit the same host again (example.com) and then redirect because your HOST ends with example.com...
You need to check the the URI is NOT /xyz already...
e.g
when HTTP_REQUEST { if { ([HTTP::uri] begins_with "/xyz") } { return } if {[string tolower [HTTP::host]] ends_with "example.com" } { HTTP::redirect "https://example.com/xyz" } }
Change begins_with to equals depending on what the rest of the content looks like...
- HamishJun 30, 2019Cirrocumulus
Because I was typing on the fly. It's starts_with not begins_with
- Mohammed_AkramJun 30, 2019Altostratus
Error in Irule