Forum Discussion
Capture part of URI and do not redirect.
- Jan 10, 2024
Thank you all for your help.
I write this irule and solve my problem.
when HTTP_REQUEST {
if { [HTTP::host] contains "example.com" }{
elseif { [HTTP::uri] starts_with "/abc" and not ([HTTP::uri] contains "abc-def") } {
HTTP::redirect /xyzThis is what happening.
example.com/abc -> redirecting to example.com/xyz
example.com/abc?=un -> redirecting to example.com/xyzexample.com/abc-def -> It stays as it is. This is my requirement.
example.com/abc-def?=un -> It stays as it is. This is okay for me now.I was looking if there is anyway example.com/abc-def?=un can also be redirected to example.com/abc-def by modifying the irule above.
when HTTP_REQUEST {
set HOST [string tolower [HTTP::host]]
set URI [HTTP::uri]
if { $HOST equals "example.com" } {
if { $URI equals "/abc-def?=un" } {
HTTP::redirect "/abc-def"
return
} elseif { $URI starts_with "/abc" && !($URI contains "abc-def") } {
HTTP::redirect "/xyz"
}
}
}- T31Jan 11, 2024
Altocumulus
Thanks. Make sense.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
