Forum Moderators: phranque

Message Too Old, No Replies

Password Protecting Directories

using the httpd.conf file

         

cawunited

8:52 pm on Jan 31, 2006 (gmt 0)

10+ Year Member



Hello,

I have a few directories that i need password protected. I have the AllowOveride set to None in the httpd.conf file, and i have:


<Directory "/home/user/directory">
AuthType Basic
AuthName "Password Protected"
AuthUserFile /home/passwd/passwords
require user user1
</Directory>

at the end of my httpd.conf file. Now, when i go to [mydomain.com...] it asks for the user and password. But, when i go to [mydomain.com...] it just shows the default index file. This is on an apache server on a Gentoo Linux machine. I used to have apache installed on a windows xp machine with cygwin on it, and i believe it protected both with and without the www. Does anyone know how to make it work like i need it to?

Thanks,
Eric

jdMorgan

12:18 am on Feb 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Eric,

Welcome to WebmasterWorld!

OK, I'll take a guess:

This <Directory> container should be inside a <VirtualServer> container, with example.com defined as the SeverName and www.example.com or *.example.com defined as the ServerAlias. If you have www- and non-www defined as separate servers (even if they point to the same DocumentRoot) then auth requirements for one won't apply to the other - the <Directory> will probably only apply to the default server (name) in that case.

Jim

cawunited

1:03 am on Feb 1, 2006 (gmt 0)

10+ Year Member



Hi,

Well, actually, i have about 10 domains on this server. I have each domain set up in it's own <VirtualHost *> with a ServerName as the mydomain.com and the ServerAlias as the www.mydomain.com and a DocumentRoot as "\home\mydomain". I had the <Directory> containers outside of all of the <VirtualHost> containers. So, i put the <Directory>'s inside of the domain that the directories are on. I restarted apache, and it still does the same thing. I'm stumped...

Eric