Forum Discussion
Lemrock_54160
Nimbostratus
Jan 31, 2014Redirect URI to different URL and only keep query strings
Trying to configure an irule to redirect from one server/uri to a different server and only keep the query after the uri
For example -
http://www.host.com/hello/thisisatest (or anything else after the /hello) redirects to http://newhost.com/thisisatest (or anything else after the /hello above)
1 Reply
- Kevin_Stewart
Employee
Is the first part of the URI static, or do you need to remove the first part of the URI no matter what it is? If the former, a simple string map should cover it:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/hello" } { set newuri [string map {"/hello" ""} [HTTP::uri]] if { $newuri eq "" } { set newuri "/" } HTTP::redirect "http://[HTTP::host]$newuri" } }
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