Search code examples
phpauthentication.htaccesshttp

Why does the password authentication set in the .htaccess file not work for me?


I want to set up a password secured file at my bplaced subdomain. I use the following .htaccess file:

<Files einstellungen.json>
  AuthName "This file is password protected!"
  AuthType Basic
  AuthUserFile .htpasswd
  Require valid-user
</Files>

<Files esp32.php>
  AuthName "This script is password protected!"
  AuthType Basic
  AuthUserFile .htpasswd
  Require valid-user
</Files>

Now I have the problem, that if I go to the file in the browser, it shows a dialog for the username and password.

I typed them in and then it shows a 500 HTTP Error, which says, that the error leads to the .htaccess file.

I've tried to use an absolute path for the .htpasswd file, but that led to the same result.

What is wrong with this .htaccess file?


Solution

  • Like @MrWhite and @hakre written in the comments, it has to be an absolute path.

    My mistake was, that I used an absolute path which refers to to wrong orgin.

    Wrong:/www/.htpasswd

    At bplaced would be right:/users/#USERNAME#/www/.htpasswd