I placed this code in the file of the .htaccessfolder I want to protect:
AuthName "restricted area"
AuthType Basic
AuthUserFile /home/
require valid-user
In the same folder, I placed this one .htpasswd:
my:pass
When I go to the URL of the protected folder, the browser constantly asks me for the password, although I type in the correct one.
I know that the root directory mentioned in AuthUserFileis ok because I found it with:
<?php
$dir = dirname(__FILE__);
echo "<p>Full path to a .htpasswd file in this dir: " .
$dir . "/.htpasswd" . "</p>";
?>
Where is the problem?
source
share