Forum Discussion
Albert__Tase_70
Nimbostratus
Aug 03, 2010adding to a redirect
Hello need some help trying to grab a piece of the uri and append it to the redirect
for example user goes to www.bbb.com wants to get redirect via a 301 to https://bbb.com/yyyy and if t...
Colin_Walker_12
Aug 11, 2010Historic F5 Account
It sounds like all you're trying to do is redirect to a second host name, preserving the URI, but making sure that no matter what the URI was, it starts with /xyz/ first. Your concern is that you don't want to end up with a URI that starts with /xyz/xyz/, right? A simple if clause will solve that problem for you.
So I think what you're looking for is something like:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/xyz" } {
HTTP::redirect "http://example2.com[HTTP::uri]"
} else {
HTTP::redirect "http://example2.com/xyz[HTTP::uri]"
}
}
Does that sound about right? If I missed something, let me know.
Colin
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