As they wrote here, htaccess works in all directories except cgi-bin
. But, as you can see from here, there's a way around it.
Basically, you edit the <Directory "C:/path/to/cgi-bin">
section of your httpd.conf file - and put there whatever would have been in the .htaccess file in cgi-bin.
Remember to restart your apache after changes to httpd.conf
One more tidbit: there's probably already a <Directory "/var/www/cgi-bin">
in your httpd.conf. Edit it - having duplicate sections causes gray hairs.
The above worked for me for password protecting the cgi-bin directory, as using .htaccess in cgi-bin didn't work. Inserting it into the <Directory "C:/path/to/cgi-bin">
section of my httpd.conf file did work.
It now says:
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
AuthType Basic
AuthName "Scripts"
AuthUserFile /var/secret/.htpasswrd
Require valid-user
Satisfy All
</Directory>