How to set up .htaccess directory protection for NextCloud?

Hello everyone,

I’m currently trying to set up directory protection via .htaccess for the directory where my NextCloud is located. This means that access via the browser would require users to authenticate with a username and password before even reaching the NextCloud login page. Every time I try to set this up, I encounter an error from Nextcloud. Is it possible to implement something like this at all? I know there are other ways to secure it, but there’s a specific reason why I want to do it this way.

Thanks for any tips and answers.

hi @Benny1 welcome to the community :handshake:

we had a discussion before - use search to find it - it doesn’t work. There is no value in adding basic authentication in front of Nextcloud. I would recommend using modern integrated methods like MFA to secure your system. find more details in this topic: How to maintain, check and improve the security of your Nextcloud installation?