First you need to turn on .htaccess in the htconf file inApache- in Leopard that file is in /private/etc/apache2/ and in Tiger it is in /private/etc/httpd/
To enable .htaccess files edit your .htconf file(s). I go into terminal and type
open private/etc/apache2/
And edit httpd.conf with textwrangler, changing
AllowOverride None
to AllowOverride All
This works for the .htaccess file (which should be in the directory you want to protect):
order allow,deny allow from .sfu.ca # deny from xxx.xxx.xxx.9 satisfy any # AuthUserFile /Library/WebServer/Documents/restricted/.htpasswd AuthName "Private" AuthType Basic require valid-userNote you can list the users from the .htpasswd file rather then using all the users- thus you need only have one .htpasswd file.
To create the .htpasswd file type this in terminal (in the directory you want the .htpasswd file):
htpasswd -c .htpasswd user1It will ask you to enter the password twice. To add users to an existing .htpasswd file omit the -c (create).
http://www.macdevcenter.com/pub/a/mac/2002/01/29/apache_macosx_four.html?page=last.
http://www.clagnut.com/blog/350/
http://www.entropy.ch/phpbb2/viewtopic.php?p=6380&