httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Henderson <henders...@gmail.com>
Subject [users@httpd] apache2 and .htaccess
Date Tue, 19 May 2009 05:59:14 GMT
Is there any way to tell Apache2 to prompt for username and password
when it sees a .htaccess file in a directory?

At the moment, I need to define the directory in the following
fashion in Apache2 conf file but it becomes a problem as I have
thousands of directories that needs .htaccess file password
protection.

For example, assuming /website is DirectoryRoot then protect
/website/a1, /website/b2 etc.

<Directory "/website/dir">
AllowOverride All
Options Indexes
Order allow,deny
Allow from all
AuthUserFile /website/dir/.htaccess
</Directory>

Here is my .htaccess file

AuthName "Restricted"
AuthType Basic
AuthLDAPURL ldap://ad.company.com:389/ou=marketing,dc=company,dc=com?sAMAccountName?sub
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
require valid-user

In /etc/apache2/default-server.conf, I have changed

DocumentRoot "/srv/www/htdocs"
<Directory "/srv/www/htdocs/">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

to

DocumentRoot "/website"
<Directory "/website/">
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>

but it don't seem to work. Thanks for any help.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message