Using .htaccess files in the Mac OS X webserver

These directions may be out of date but hopefully a good guide. Also check out SFU CAS setup for MAC and SFU's access control page.

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):

Note 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):

It will ask you to enter the password twice. To add users to an existing .htpasswd file omit the -c (create).