Password protecting a directory with htpasswd
Posted by:
Fluffy654
(78.151.92.---)
Date: August 11, 2009 07:44PM
Okay I'm just trying to password protect a folder at C:/wamp/www/website/admin
In this folder, I have placed the .htaccess file and it looks like this:
AuthName "restricted area"
AuthUserFile C:/wamp/www/.htpasswd
AuthType Basic
require valid-user
Then in C:/wamp/www/ I have the .htpasswd file which looks like this:
admin:test
However, when I go to a file in C:/wamp/www/website/admin and am prompted for my login details, it throws an error and the Apache error log tells me that there was a password mismatch.
On another forum, someone suggested changing httpd.conf:
Change AllowOverride None
to AllowOverride All
so the directory portion now looks like:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
Going back and trying to login again, Apache now gives me a different error, saying that the user admin cannot be found.
I'm on Windows 7 and using the latest version of WampServer. My website is also set up as a virtual host on my local computer and I'm not sure if this will affect things.
Any help or advice would be greatly appreciated! Thanks!