I'm trying to password protect a directory on my site. I can get the .htaccess working so that when I visit the directory a password prompt is shown, however when I put the correct credentials that I've stored within my .htpasswd file I am not granted access. The password prompt just pops up again.
I believe it's a problem with the path to the .htpasswd file in the .htaccess file. I've checked my document root (_SERVER["DOCUMENT_ROOT"]) and it shows that the root is this:
/var/www/vhosts/myurl.info/httpdocs
so my .htaccess looks like so:
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/vhosts/myurl.info/httpdocs/.htpasswd
AuthGroupFile /dev/null
require valid-user
I've put the .htpasswd in the root document folder (httpdocs).
Any ideas what I'm doing wrong? Everything looks correct to me.
username:passwordhash