Forum Discussion
Boris_Artemyev_
Nimbostratus
Aug 08, 2007Partial URI rewrite v 4.5
Hello,
I searched for a relative answer to no avail.
We would like to implement the following:
redirect http://www.mywebsite/my/very/long/dynamic/uri to http://www.mywebsite/our/very/lo...
hoolio
Cirrostratus
Aug 09, 2007Hi,
If you always want to redirect requests that start with "/my/very/long", you could use something like this:
rule my_rule {
if (http_uri starts_with "/my/very/long/") {
redirect to "https://www.foorbar.com/our/very/log/%u"
} else {
use pool http_pool
}
}
Else, if a string comparison won't work, you could use matches_regex to describe when to issue the redirect:
rule my_rule {
if (http_uri matches_regex "/my/very/long/(?:some_dynamic_string)") {
redirect to "https://www.foorbar.com/our/very/log/%u"
} else {
use pool http_pool
}
}
[Edits: the %u is substituted for the original URI. And it's more resource intensive to use matches_regex versus one of the string comparisons like starts_with, contains or ends_with.]
Aaron
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