I have an authentication defined in my .htaccess on my dev domain but I want to put it in apache2.conf instead. If I try to cut/paste the lines, the authentication stops working.
This is my configuration for the directory in question:
<Directory /home/dev>
AllowOverride None
<FilesMatch "^.*\.([Hh][Tt][AaPp])">
Require all denied
</FilesMatch>
#AuthType Basic
#AuthName "Dev Domain"
#AuthUserFile "/home/dev/public_html/.htpasswd"
#Require all denied
#Previously in .htaccess
SetEnvIf Host dev.mywebsite.com auth
AuthType Basic
AuthName "Dev domain"
AuthUserFile "/home/dev/public_html/.htpasswd"
Require valid-user
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auth
</Directory>
Any form of Require (Require all denied, Require valid-user) or Deny seems to be ignored. Even the AllowOverride None doesn't work because if I put these lines in /home/dev/public_html/.htaccess, the authentication works.
RewriteRules works though.