Migrating server from subfolder to root folder while keeping subfolder links and sync functional

Nextcloud version (eg, 20.0.5): 23.0.0.10
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04 / docker
Apache or nginx version (eg, Apache 2.4.25): 2.4.51
PHP version (eg, 7.4): 8.0.14

We migrated our nc server to a new setup and nc is now running in a docker image with nginx reverse proxy. The setup works fine, just the old nc server was accessible via
https://somedomain.com/nextcloud

and the new server is set up as
https://somedomain.com

Now I want to have all the old links, e.g.
https://somedomain.com/nextcloud/index.php/f/1823725
to be redirected to
https://somedomain.com/index.php/f/1823725
so they continue to work.

Ideally all the users that are using the desktop client for sync do not have to change their configuration, so https://somedomain.com/nextcloud continues to work for the desktop client.

The first one should be possible, however the .htaccess redirect we tried
RewriteRule ^nextcloud/(.*)$ $1
did not work. Every url in nextcloud/ is redirected to the dashboard.

Any ideas if this can work at all (first one should be possible, not sure about the second one) and how we could achieve this?

Thanks and happy new year!

Nobody has any ideas?