Dyamic Redirect Rules With Wildcard

Hello,
I want to transform something like https://dev.example.com/*branch* to *branch*.something.pages.dev.
I have the following dynamic rule in place but I’m not sure what’s going wrong.

concat(substring(http.request.uri.path, 1), ".something.pages.dev")

Expected: dev.example.com/testtest.something.pages.dev.
Getting: dev.example.com/test.something.pages.dev and then redirect loop as expected.

Any help would be appreciated.

As you are wanting to redirect to a new subdomain, the Redirect UK and France visitors to their specific subdomains example is appropriate.

Something like

lower(concat("https://", http.request.uri.path, ".example.com"))