Skip to content
Advertisement

How to set view protection in the beginning by .htaccess in the XAMPP for sub directories?

I have local website(php) on xampp and I want set user password login protection as shown as

enter image description here

I set in .htaccess :

Options -Indexes
allow from 127.0.0.0
AuthName "Password Protected Area" 
AuthUserFile /htaccess/.htpasswd 
AuthType Basic
Require valid-user

And in .htpasswd I set:

user:$2y$10$L7cqU20P.fbfHwIL7cqU20PsvrhnN.Pb1rAxR50y

But I after enter user password I get this error: enter image description here

I use this but not work. When I enter http:127.0.0.1/hi that work but when I enter sub directory not work (http:127.0.0.1/hi/test1) and give 500 error .

Advertisement

Answer

My code was OK but I do not know why an .htaccess empty file was created in all my sub folders when I delete them work correctly.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement