I have apache 2.4.57 on a windows server. I created a new folder that only needs to display files that can be downloaded. In the httpd.conf file, I added this:
Alias "/pw_files" "f:\www_shared\pw_files"
<Directory "f:\www_shared\pw_files">
Require all granted
Options Indexes
IndexOptions FancyIndexing HTMLTable FoldersFirst SuppressDescription SuppressLastModified NameWidth=* IconWidth=20 IconHeight=20
IndexStyleSheet /css/autoindex.css
</Directory>
I created a .htpasswd file in the f:\www_shared\pw_files with this:
AuthType Basic
AuthName "please enter credentials"
AuthUserFile f:\www_shared\pw_files
AuthGroupFile "c:/apache_php/apache/htpasswd_group2.txt"
Require group pw_files
I created a new user:
htpasswd -c f:\www_shared\pw_files\.htpasswd pw_user
I moved the output from .htpasswd into the .htpasswd file in c:\apache_php\apache
In c:/apache_php/apache/htpasswd_group2.txt I have:
pw_files: admin pw_user
I made these changes and restarted.
However, when I go to:
http://www.example.com/pw_files
it takes me right to view the contents of the folder, but I never get the prompt to enter the username and password. I'm not sure what I missed.