Forum Discussion
PeterC_70986
Nimbostratus
Apr 18, 2013Help with a redirect while changing a small part of the URI
I am trying to do a redirect which will look like below:
hostname.domain.com/abc/varying_remainder_uri redirect to NEWhostname.domain.com/def/varying_remainder_uri
I did the below which I...
Kevin_Stewart
Employee
Apr 18, 2013Assuming the /abc/ and /def/ portions of the URI are static, you could use some string mapping:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/abc"} {
set newuri [string map {"/abc/" "/def/"} [string tolower [HTTP::uri]]]
HTTP::redirect "https://NEWhostname.domain.com$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