Forum Discussion
https redirection
Hi Anush,
accuracy and performance wise the code below would be most effective...
if { ( [HTTP::host] eq "devcentral.com" ) and ( [HTTP::path] starts_with "/groups/Research/" ) } then {
HTTP::redirect "https://f5.com/devresearch/[string range [HTTP::uri] 17 end]"
}
... almost equals (but without -NOCASE support)...
if { ( [HTTP::host] eq "devcentral.com" ) and ( [HTTP::path] starts_with "/groups/Research/" ) } then {
HTTP::redirect "https://f5.com/devresearch/[findstr [HTTP::uri] "/groups/Research/" 17 end]"
}
... closely followed by a ...
if { ( [HTTP::host] eq "devcentral.com" ) and ( [HTTP::path] starts_with "/groups/Research/" ) } then {
HTTP::redirect "https://f5.com/devresearch/[string range [HTTP::uri] [string length "/groups/Research/"] end]"
}
... almost equals (but without -NOCASE support) ...
if { ( [HTTP::host] eq "devcentral.com" ) and ( [HTTP::path] starts_with "/groups/Research/" ) } then {
HTTP::redirect "https://f5.com/devresearch/[findstr [HTTP::uri] "/groups/Research/" [string length "/groups/Research/"] end]"
}
... closely followed by the less accurate (the [getfield] search patter may occour multiple times and without -NOCASE support) method ...
if { ( [HTTP::host] eq "devcentral.com" ) and ( [HTTP::path] starts_with "/groups/Research/" ) } then {
HTTP::redirect "https://f5.com/devresearch/[getfield [HTTP::uri] "/groups/Research/" 2]"
}
... followed by the less accurate (the [string map] search patter may occour multiple times) and less performant method ...
if { ( [HTTP::host] eq "devcentral.com" ) and ( [HTTP::path] starts_with "/groups/Research/" ) } then {
HTTP::redirect "https://f5.com[string map [list "/groups/Research/" "/devresearch/"] [HTTP::uri]]"
}
Update: Included the [findstr] command.
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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