[CentOS] Password Protecting a Root Directory

John Hinton webmaster at ew3d.com
Mon Feb 18 23:20:13 UTC 2008


Jim Perrin wrote:
> On Feb 18, 2008 3:30 PM, John Hinton <webmaster at ew3d.com> wrote:
>   
>> I have apache running with virtual hosting.
>>
>> I have a customer who wants to password protect their /user/public_html
>> directory using htaccess. I've done this many times on directories
>> inside of that directory with positive results. However, I don't seem to
>> be able to password protect the document root directory.
>>
>> Any ideas?
>>     
>
> Do you have AllowOverrides on for the webroot?
>
>
>   
Actually, I was trying to do something that was sort of working, but 
apparently Apache was seeing it differently.

This was for a subdomain. Instead of creating the usual 
/var/www/user/public_html, I had pointed Apache at a directory inside of 
the domain's document root. There turned out to be no advantages to this 
except I guess one could argue a single place to FTP in.

I tried my same setup with another subdomain with it's own standard 
document space, and it all worked like I expected.

So, I'm betting that Apache was somehow assigning that first subdomain's 
directory and the htaccess stuff to the main domain and in fact it did 
work that way. But, when using the subdomain it didn't see the 
directives at all. I bet if I moved the subdomain in front of the domain 
in the vhosts list, that this would work, but, that's a pretty darned 
fragile way of doing things.

So, I'm punting... I'm going to change it all over to using it's own 
unique document root and not go any further with this mess.

Thanks,
John Hinton



More information about the CentOS mailing list