You have two possibilities:
- Using redirect rules from mod_alias, as in OT, to let the clients send a new requests to the redirects address/path.
- Using rewrite rules from mod_rewrite, handling the path adjustment silently server side without new client requests, as suggested in the follow up answers.
I don’t know much about pros/cons, the first solution seems a bid simpler though.
But each of them need to be set inside your webserver or vhost config, as long add Nextcloud is not already your webroot. How should otherwise the server know about requests/redirects if the related rules ate in a sub directory .htaccess where it’s not yet inside .
For the same reason the default .htaccess inside Nextcloud directory does not have any effect. It just works with Nextcloud add webroot, pointing to the then correct relative path without /nextcloud subdir inside.