I am writing a htaccess file for Apache 2.4.
I have in the basic config the directives "AllowOverrideAll" and "Require all granted" and I want to restrict the access to a folder.
Then I create a .htaccess file in the folder. The file works if I set for example "Require all denied", but if I set "Require valid-user" I have a misconfiguration error.
For example, if I try the htaccess with this content
AuthType Basic
AuthName "Authentication Required"
Authuserfile "/etc/htpasswd/.htpasswd"
require all denied
works ("Forbidden: You don't have permission to access /TorGuard/ on this server.") but with this content
AuthType Basic
AuthName "Authentication Required"
AuthUserfile "/etc/htpasswd/.htpasswd"
require valid-user
I have an error ("Internal Server Error: The server encountered an internal error or misconfiguration and was unable to complete your request.")
In particular I am working on a QNAP and the htaccess is in the folder of the WEBUI of my application.