.htaccess:
AuthName "Restricted Area".htpasswd:
AuthType Basic
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
require valid-user
user:passwordPossibly it will be a 404 error when you access the folder from the web. Deleting .htaccess and .htpasswd, it will be fine again.
This is because Apache tries to look up the 401 document or whatever when it can't locate it. Just add this line to the end of .htaccess and the problem will go away.
.htaccess:
AuthName "Restricted Area"That's it. Try again and it will work now!
AuthType Basic
AuthUserFile /home/thedatap/public_html/captain/.htpasswd
AuthGroupFile /dev/null
require valid-user
ErrorDocument 401 "Authorization Required"