Search code examples
.htaccess

htaccess IP restriction and htpasswd


Is there a way to require the use of htpasswd if the user is not in a certain IP range?

I have this right now:

Order Deny,Allow
Deny from all
AuthName "Htacess"
AuthUserFile /var/www/Test/.htpasswd
AuthType Basic
Require valid-user
Allow from 111.111.111.111
Satisfy Any

But it's giving me a 500 error


Solution

  • Figured it out

    AuthName "Htaccess"
    AuthUserFile /var/www/test/.htpasswd
    AuthType Basic
    Satisfy Any
    <Limit GET POST>
        Order Deny,Allow
        Deny from all
        Allow from 111.111.111.111
        Require valid-user
    </Limit>