Log in

View Full Version : htaccess - allow some unrestricted, login user+pass for everyone else



stanbridge
12-04-2008, 05:09 AM
I am trying to setup a protected folder on my website with the following two rules:

1) Users coming from one of our two static IPs can access the folder without needing to enter a username or password.

2) All other attempts to access the folder are met with a username and password login.


I have been able to meet point 1 with the following .htaccess file code...


#deny all access
deny from all
allow from 111.222.333.444 111.222.333.555

<IfModule mod_speling.c>
CheckSpelling On
</IfModule>


I have been able to meet point 2 by using the Dynamic Drive htaccess generator at the following location: http://tools.dynamicdrive.com/password/


Unfortunately my attempts to combine the code has failed.

Is this even possible. If so, can someone show me how?


Cheers,

Stanbridge

stanbridge
12-05-2008, 05:04 AM
Ah, nevermind folks, got it sorted...

I found another page that has a list of sample HTACCESS files:
http://www.evolt.org/ultimate_htaccess_examples

Someone on another forum also showed me this page:
http://httpd.apache.org/docs/1.3/mod/core.html#satisfy

My finished, working HTACCESS file looks like this:


Order allow,deny
AuthUserFile /usr/home/myfolder/.htpasswd
AuthType Basic
AuthName "MyFolder TopSecret Area"
Require valid-user
Allow from 111.222.333.444 111.222.333.555
Satisfy Any


Cheers,

Stanbridge