.htpasswd in coding

Hello, I want a password to be protected by one of my controllers in the encoder. This is the code in .htaccess

# password-protect single file
<Files my_controller.php>
AuthName "my_controller.php"
AuthType Basic
AuthUserFile /home2/afolder/.htpasswds/.htpasswd
require valid-user
</Files>

the problem is that myController.php will appear in my url as /my_controller/(no.php), so protection has no effect ... can I do something to overcome this problem? thanks in advance

+3
source share
1 answer

Finally, the solution was as simple as ...

# password-protect single file
<Files my_controller>
AuthName "my_controller"
AuthType Basic
AuthUserFile /home2/afolder/.htpasswds/.htpasswd
require valid-user
</Files>

just deleted .php and everything is fine ...

+9
source

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


All Articles