rewrite handles URI changes internally and invisibly to the client. Since you actually want to bump them to a different domain, you’ll want to use redir instead.
Since in normal usage, from must be exact, but you want to redirect under a base path instead, you’ll have to use if functionality like this to check for the base path yourself:
redir {
if {path} starts_with /foo/bar
/ https://example.com:443/foo/bar{uri}
}
Alternately, you could self-contain it within its own site definition, which surprisingly requires fewer lines: