Forum Discussion
Mohammed_Akram
Altostratus
Jun 25, 2019request needs to redirect from https://www.example.com to https://example.com/xyz
I needs to redirect the URL if a user enters https://www.example.com it should redirect to https://example.com/xyz , I have http to https irule applied on 80.
Hamish
Cirrocumulus
Jun 30, 2019If 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...
Mohammed_Akram
Altostratus
Jun 30, 2019Error in Irule
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
