[Solved] Rewrite a complete URL instead of just path or uri

I put my example in here: https://dooby.fr/links/?IxO7cg

http-request redirect code 301 location https://my.url.com%[path,regsub(^/my_old_path,,)] if { path_beg /my_old_path }

here, the purpose is to redirect a hit on https://url.com/my_old_path/foo/bar/baz to https://my.url.com/foo/bar/baz

Thank you! I’ve been looking for a solution on how to alter the path on a redirect.
I adapted your solution to preserve the query parms by changing “path” to “capture.req.uri” as follows:

http-request redirect code 301 location https://my.url.com%[capture.req.uri,regsub(^/my_old_path,)] if { path_beg /my_old_path }

This allows me to rewrite

https://my.url.com/my_old_path/foo/bar/baz?p1=v1&p2=v2&p3=v3

to

https://my.url.com/foo/bar/baz?p1=v1&p2=v2&p3=v3