.htaccess auth?

Nextcloud version: 11
Operating system and version: all-inkl host
PHP version:7

The issue you are facing:
How can I secure my nextcloud installation with a .htaccess password in the root?

I added at the bottom of the .htaccess file
AuthUserFile /www/htdocs/urlXXXX/.htpasswd
AuthGroupFile /dev/null
AuthName 'bitte Zugangsdaten eingeben’
AuthType Basic
require valid-user

and added the needed .htpasswd file.

In the webbrowser I can access, but the login procedure take minutes, and the login with the windows desktop sync app doesn’t work. I added the login credentials like https//:username:password@nextclouddomain.com, but a step later the user and password of the nextcloud installation is not accepted.

What can I do? I wnat to make my installation be hacker safe with a .htaccess password.

Thanks, best regards
Eric