Honestly, that seems like the best approach. Updating the actual data to have the correct URLs is better, because any other solution will just be hacky.
This would only work to replace the URI on requests which actually reaches your Caddy server. If the request is for a different domain altogether which won’t reach Caddy, then this will never be effectual.
This directive also can’t replace a domain, because it operates on the part of the URI that comes after the domain, which is the path & query.
rewrite and uri are both rewrites, just with slightly different behaviour and feature sets depending on the needs.
redir basically just writes a response with a Location header, but again, this will never run if the request never reaches your server. So it’s not useful here either.
What you’d actually need is the replace_response plugin which can perform streaming string replacements on the responses before they’re sent back to the browser, so you could modify the contents before users click on the links.
But this is a hack, and can harm performance, and means you’re “doing work” on every single request to check for old links and replace them, even for new pages which were created after your site was moved.
It’s way simpler to just update the existing data once and be done with it.