Josh_Abaire
Oct 23, 2012Nimbostratus
Modify one part of URI Path
I need to change one portion of a URI path based on the value of another portion. For example:
http://www.example.com/dir1/dir2/file.ext?arg1=val1&arg2=val2&arg3
If dir2 then change dir1 to dir5.
HTTP::respond 302 Location http://www.example.com/dir5/dir2/file.ext?arg1=val1&arg2=val2&arg3
I can pull out the 2nd part:
set path2 [URI::path [HTTP::uri] 2 2]
I can check it against the list of values in a data-group and supply the new value but I don’t know how to modify only one portion of the URI.
I'm looking for a command like the set command, only rewrite URI:path portion based on an index.
Thanks!