Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

htaccess to allow from IP, otherwise get login and pass?

Status
Not open for further replies.

redsevens

IS-IT--Management
Aug 11, 2000
40
US
I'd like to grant access based on one of two conditions:
User is from domain w.x.y.* or w.x.z.*
if not, use basic authentication to grant access.

I have the authentication set up like this (in .htaccess):

AuthType Basic
AuthName Intranet
AuthUserFile /path/to/userfile
AuthGroupFile /dev/null
<Limit GET POST>
require valid-user
</Limit>

Any help would be appreciated!
 
I found something that is supposed to work, but doesn't:
Code:
AuthType Basic
AuthName Intranet
AuthUserFile /home/.userfile
AuthGroupFile /dev/null
Satisfy any
require user joe    
order deny,allow
deny from all
allow from fakedomain.com
After testing this out, I found that my allow directives are being ignored, whether they are in .htaccess or even httpd.conf. I've tried using crazy IPs and domains to try to get denied from the server and nothing seems to work. Has anybody encountered this before?
 
Try this for you .htaccess file:

AuthType Basic
AuthName Intranet
AuthUserFile /path/to/userfile

<LIMIT GET POST>
order deny,allow
deny from all
allow from w.x.y.
allow from w.x.z.
require valid-user
satisfy any
</LIMIT>


Also, in your httpd.conf file you will need to have an
AllowOverride AuthConfig Limit
entry for the directory you are protecting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top