[NTLUG:Discuss] Apache and .htpasswd

David david at hayes-family.org
Tue Aug 12 20:46:53 CDT 2003


On Tue, Aug 12, 2003 at 11:54:57AM -0500, Richard Humphrey wrote:
> Can Apache be configured to read from more than one .htpasswd file? We
> have several .htpasswd files and we need to authenticate users on a
> specific page from each .htpasswd file. How can we do this?

Try this:

<Files /home/www/top-web-dir/sub-dir/file1.html>
  AuthType	Basic
  AuthName	File-Security-Area-1
  AuthUserFile  /home/www/htpasswd-1

  Require	valid-user
</Files>

<Files /home/www/top-web-dir/sub-dir/file2.html>
  AuthType	Basic
  AuthName	File-Security-Area-2
  AuthUserFile  /home/www/htpasswd-2

  Require	valid-user
</Files>


The best place to put security directives is in the Apache global
configuration files, or in a virtual host config file if applicable.
Don't put them in the .htaccess files, because they're more likely to
be tampered with.

-- 
David Hayes
david at hayes-family.org



More information about the Discuss mailing list