Forum Discussion
Danny_Trinh_197
Nimbostratus
Jan 11, 2009Redirect test.example.com to test.example.com/abc/def/gh...i
I searched this forum but couldn't find the answer, and I'm kind new to F5.
What can I do to redirect:
this url: http://test.example.com
to:
http://test.example.com/abc/def/ghi/jkl/mno/
I found this below, but I got an error of looping:
when HTTP_REQUEST {
if { [HTTP::host] equals "webclient.example.com" } {
HTTP::redirect "http://webclient.example.com/abc/def/ghi/jkl/mno/"
}
}
Thanks,
3 Replies
- hoolio
Cirrostratus
You can add a check of the URI so you're only redirecting clients who make a request to the root (/):when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "webclient.example.com" && [HTTP::path] eq "/" } { HTTP::redirect "http://webclient.example.com/abc/def/ghi/jkl/mno/" } }
Aaron - Danny_Trinh_104
Nimbostratus
It's work great. Thanks,
Another question:
What can I add to this iRule so it doesn't matter what the client type (http://webclient.example.com; https://webclient.example.com; or just webclient.example.com), it always redirect to http://webclient.example.com/abc/def/ghi/jkl/mno/?
Thanks in advance, - hoolio
Cirrostratus
The host header value doesn't include the protocol, so this iRule would work for HTTP or HTTPS. If you have an HTTP VIP and an HTTPS VIP, you can use this iRule on both VIPs.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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