I believe that’s what the conditional rewrite condition in that example configuration was for, but it’s admittedly pretty tough to parse.
I think this line is what tells it to only apply the
overwritehost option to queries that come through the proxy:
‘overwritecondaddr’ => ‘^10.0.0.1$’,
If that’s not an option, then I’d set up an additional reverse proxy host, and have it translate all those redirections with Apache’s
ProxyPassReverse options. Here is an old guide for doing that with ownCloud. a.lan would be your internet accessible address, and b.lan would be your .onion-accessible proxy server, rather than lan-only and internet.