0

This question already has an answer here:

I need to add directory protection to one of my folders. It should only be accessible after entering valid credentials.

The folder ist at /srv/www/vhosts/myproject/errors/protected_folder/ the url is https://www.example.com/errors/protected_folder/

So I created a .htaccess file in the target folder with this content:

AuthName 'Enter Credentials'
AuthType Basic
AuthUserFile /srv/www/vhosts/.htpasswd
require valid-user

I generated the .htpasswd file with a random generator found online.

I also tried it with htpasswd -c /srv/www/vhosts/.htpasswd myuser like described in the documentation.

But if I try to open the site with the above link, then there is no login alert window shown.

marked as duplicate by womble May 5 at 23:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.