Forum Discussion
How to prepend string to existing URI
Hi,
Just wondering how I might go about inserting(prepend) a string at the beginning of a URI
e.g.
https://www.something.com/param1¶m2
changed to
https://www.something.com/param3¶m1¶m2
- daveclarkjr
Nimbostratus
Let me know if this helps. Set the following iRule. You can also do this using policies as well.
when HTTP_REQUEST { if { [HTTP::uri] eq "/"}{ HTTP::redirect [string map {/param1¶m2 /param3¶m1¶m2}[HTTP::uri]] } }
- daveclarkjr
Nimbostratus
sorry on the eq have that match param. or whatever your landing page will be.
Code
when HTTP_REQUEST { if { [HTTP::uri] eq "/param1¶m2"}{ HTTP::redirect [string map {/param1¶m2 /param3¶m1¶m2}[HTTP::uri]] } }
- jaikumar_f5
Noctilucent
Please test this, I've been using this to match with host and uri.
when HTTP_REQUEST { if { [HTTP::host] eq "www.something.com" } { if { [HTTP::uri] starts_with "/param1¶m2" } { HTTP::redirect "/param3¶m1¶m2" } else { } } else { } }
- daveclarkjr
Nimbostratus
when HTTP_REQUEST { if { [HTTP::uri] eq "/param1¶m2"}{ HTTP::redirect [string map {/param1¶m2 /param3¶m1¶m2}[HTTP::uri]] } }
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