.htaccess Password Protection Continues to Request Password Again and Again

I placed this code in the file of the .htaccessfolder I want to protect:

AuthName "restricted area"
AuthType Basic
AuthUserFile /home/#/#/#/#/#/.htpasswd
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?

+4
source share
3 answers

, , htpasswd , htaccess. , , , , htpasswrd, . , . , , , htpasswd , 2 htpasswrd . htacccess htpassrd, , , .

+1

"" require valid-user

:

Require user markpanado

:

Require markpanado
+1

. :

AuthType Basic , - 401.

Is it possible that each request from the server sent a message with a status code of 401 HTTP? You can check the developer console to find out.

0
source

Source: https://habr.com/ru/post/1533523/


All Articles