Reputation: 183
I want to set password for one directory using Apache server so that only authorized persons can access to the directory. I have created .htpasswd file inside the directory. And it contains one line
username:$apr1$5H33Pfw6$WApVs3KlrU7QgBqYrFgeW.
password is "password". And my Directory Preferences are
<Directory />
AuthType Basic
AuthName "Example Repository"
AuthUserFile /.htpasswd
Require valid-user
</Directory>
When accessing the directory from browser it asks for username and password. After entering username and password request fails. Http Request error code is 403. What could be the error. Thanks.
Upvotes: 1
Views: 1130
Reputation: 1019
Taken from http://httpd.apache.org/docs/2.2/mod/mod_authn_file.html
Syntax: AuthUserFile file-path
File-path is the path to the user file. If it is not absolute, it is treated as relative to the ServerRoot.
Upvotes: 1
Reputation: 161
You must provide the complete path to your .htpasswd file. Try with
AuthUserFile /complete/passwd/file/path/.htpasswd
Hope it helps.
Upvotes: 1