Laravel/React .HTACCESS and .HTPASSWD not working

879 Views Asked by At

I want to secure by basic http authentication my dev site in Laravel with .htaccess and .htpasswd.

First, I created my .htpasswd user and password (https://shop.alterlinks.com/htpasswd/htpasswd.php MD5). Then, my htaccess file with some basic configurations.

I placed my .htaccess file on my project directory /home/user/public_html/laravel_project. Then .htpasswd file in /home/user/htpasswd/.htpasswd.

Also in my apache configuration file, I have AllowOverride All

.htaccess code:

AuthType Basic
AuthName "Site Administratrion"
AuthBasicProvider file
AuthUserFile "/home/user/htpasswd/.htpasswd"
Require user admin

After all those configurations, I cleared my cache and tested. At first asks normally for credentials, the login page of my site loads but after i login asks again for htpasswd credentials and throws an ERROR 401 Unauthorized

Error:

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

By the way, I don't have apache logs on this problem.

Is it Laravel/React related? I need aditional configurations? I think i've tried almost anything.

0

There are 0 best solutions below