H
H
Henry2016-05-22 16:51:00
htaccess
Henry, 2016-05-22 16:51:00

How to implement password access through .htaccess, taking into account the ip address?

There is a task: to implement password authorization through .htaccess , but on the condition that authorization from a certain IP will not be required. I found this solution, but the server returns a 500 error:

<If %{REMOTE_ADDR} != '127.0.0.1'>
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /home/user/www/site.ru/.htpasswd
Require valid-user
</If>

the path to .htpasswd is correct.
Can someone tell me another solution or why it might not work for me and how to be?
Important! You need to implement it by editing the .htaccess file

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question