# Solved: .htaccess Allow from local IP OR valid user password



## computer_pet (Jun 22, 2003)

Is there some way either in apache conf or .htaccess files to allow access to directives if they have either:

A - A local IP address (ie. 192.168.1.xxx)
OR
B - They have entered a correct .htpasswd and user (Auth)

If they do have a valid IP address the Auth login will not appear, except If they do not have a valid IP it will.

I have tried the following in a .htaccess file:



> allow from 192.168.1.
> allow from proxy.tpg.com.au
> AuthUserFile /pass/.htpasswd
> AuthGroupFile /pass/.htgroup
> ...


Except this continues to display the Auth login box, even if computer has local IP. I can get the .htaccess to only allow from local IP (have tested it), but If I am not at my computer which is connected to my network I will not be able to access this directive.

Any Help


----------



## computer_pet (Jun 22, 2003)

^^top^^


----------



## Squashman (Apr 4, 2003)

We did this a couple of years ago in a school project, but I cannot remember how to do it. I might have it archived somewhere in an old notebook.


----------



## Squashman (Apr 4, 2003)

I did not find my old notes but did find a website that explains it a little.

http://www.stsci.edu/web/access_control.html



> Access Control for Local Access but Username and Password for Everyone Else
> Suppose you want to allow all internal users to access a page, but require external users to supply a username and password. There is a way to do that. Basically, you put the rules for both kinds of access into your .htaccess file, and then add the directive
> satisfy any
> 
> ...


----------



## computer_pet (Jun 22, 2003)

Works perfect!    
Thanks for your help


----------

