user2138152
user2138152

Reputation: 131

htaccess Internal server error, authentication loop

I am attempting to set up htaccess to restrict access to a particular folder. I currently have as follows:

Htaccess:

AuthType Basic
AuthName "Restricted area"
AuthUserFile /home3/user/public_html/.htpasswd
require valid-user

ErrorDocument 404 "Error"
ErrorDocument 401 "Error"
ErrorDocument 403 "Error"

htpasswd:

Guest:GuestPassword

Using this method I will either have a 500 server error returned, OR it will loop and continuously prompt me for authentication.

Any help is appreciated!

ALSO: I used showphp() to get the Document root. So AuthUserFile path should be correct.

Thanks!

Upvotes: 3

Views: 1862

Answers (1)

chrislondon
chrislondon

Reputation: 12031

The infinite loop asking for your password is what you want to see. That means you typed in your password wrong. The Internal Server 500 Error means you have another issue in your code. The reason your username and password aren't working is because your server expects the password to be hashed.

Change your .htpasswd file to:

Guest:$apr1$u5E5vgOR$6rPNEYkeaF5IVE4c3FyKM0

(The password is GuestPassword)

Upvotes: 6

Related Questions