I need to restrict certain user from a BasicAuth configured system to come only from certain IP address but allow the rest to come from anywere.

I know that I can restrict access using Deny and Allow directives and know also how to restrict access to users using Require. But I need a mix of both and I don't have a clue.


You need to use the Satisfy directive. I believe it would look something like this:

AuthUserFile /path/to/File
AuthName "Go away"
AuthType Basic
Require valid-user

Satisfy any
Order allow,deny
Deny from all
Allow from

This will block everyone except unless they enter a password.

If you only want to make the one IP enter the password and allow everyone else with no restrictions then it would be:

Satisfy any
Order allow,deny
Deny from
Allow from all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.