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