Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess Password protection keeps asking for password over and over

I've placed this code in the .htaccess file of the folder I want to protect:

AuthName "restricted area"
AuthType Basic
AuthUserFile /home/#/#/#/#/#/.htpasswd
require valid-user

In the same folder, I placed this .htpasswd:

my:pass

When I go to the URL of the protected folder, the browser keeps asking me for a password over and over, even though I'm typing the correct one.

I know that the root directory mentioned in AuthUserFile is ok because I've found it out with:

<?php
    $dir = dirname(__FILE__);
    echo "<p>Full path to a .htpasswd file in this dir: " . 
        $dir . "/.htpasswd" . "</p>";
?>

Where's the problem?

like image 709
rockyraw Avatar asked Mar 26 '14 12:03

rockyraw


1 Answers

Just add "user" in between require valid-user

For example:

Require user markpanado

But not:

Require markpanado
like image 167
Mark Avatar answered Oct 21 '22 13:10

Mark