Ive read through previous threads about getting password protection for directories useing .htaccess and .passwd files. I am curious if anyone has gotten it to work on Windows? I've tried, and seems like Apache is just ignoring .htaccess
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride All
in your httpd.conf file. I think it's set to None by default, changing it to all should allow you to protect your dirs. Hope this helps.
As polarz says, you need to allow overrides for the directory concerned in httpd.conf (or just globally if you really wish)
You'd need something like :
<Directory "C:/Program Files/Apache Group/Apache/htdocs/test">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Then in the .htaccess file in that same directory :
AuthName "ABC"
AuthType Basic
AuthUserFile "C:/Program Files/Apache Group/Apache/auth/.htpasswd"
require valid-user
(you should be able to use either forward or backslashes)
If you then test it and you get a login prompt with realm 'abc' (or whatever) then its reading the .htaccess file. If not thats the first problem.
If the login prompt appears but the userid / passwords don't work then it probably can't find the .htpasswd file. Double check the path .
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.