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/long/dynamic/uri
"/dynamic/uri" part is challenging.
Any input will be highly appreciated.
Thank you,
Boris.
- hoolio
Cirrostratus
Hi,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 } }
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 } }
- Boris_Artemyev_
Nimbostratus
Aaron, - hoolio
Cirrostratus
In the F5 lexicon, %h refers to the host and %u refers to the URI, so the example should work for you, assuming you're able to match just the requests you want redirected. - Deb_Allen_18Historic F5 AccountI think Boris is right, that the URI will contain both the old part and the new part that way.
rule my_rule { if (tolower(http_uri) starts_with "/my/very/long/") { redirect to https://www.foorbar.com/our/very/long/ + substr(http_uri, 14) } else { use pool http_pool } }
- Deb_Allen_18Historic F5 Account(corrected syntax above)
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