LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   apache, .htaccess in diffrent dirs.. (https://www.linuxquestions.org/questions/linux-software-2/apache-htaccess-in-diffrent-dirs-298620/)

rincewind 03-07-2005 04:40 AM

apache, .htaccess in diffrent dirs..
 
Hello all,
I got this problem with my apache running on my gentoo server...=(

My document root is
/var/www/localhost/htdocs

and if I put in a .htaccess file that looks like this in
/var/www/localhost/htdocs/test/

Code:

/var/www/localhost/htdocs
AuthUserFile /var/www/localhost/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic

require user smurf

and it works realy well.. I get an box that asks me

Then I have a lot of vhosts ... For instance one that goes to
/var/www/localhost/www.mydomain.com

my vhosts.conf has a line that looks like this:
DocumentRoot /var/www/localhost/www.mydomain.com

I can browse that page without problem, yet when I put in the exactly same .htaccess file as abowe, i dont get to a responce that asks for username and password.. It seems to skip the .htaccess file

Does anyone now what I have done wrong?
Can anyone help me??=)

Regardz,
-- Rincewind

linuxxed 03-07-2005 05:37 AM

If you're on the same browser session that has authenticated for one user (for the same dir) then the browser will send the auth info without prompting.

Try testing on a new browser session.

rincewind 03-07-2005 05:51 AM

I've already tried that...
Even tried it in a another browser...
So thats not the case..=(

bathory 03-07-2005 07:22 AM

Use the "AllowOverride AuthConfig" directive inside your vhost definition as you do in your DocumentRoot

rincewind 03-07-2005 07:33 AM

Hmm thanks...
But I get the following message after doing a

/etc/init.d/apache2 restart


* Stopping apache2...
Syntax error on line 93 of /usr/lib/apache2/conf/vhosts/vhosts.conf:
AllowOverride not allowed here [ ok ]
* Apache2 has detected a syntax error in your configuration files:
Syntax error on line 93 of /usr/lib/apache2/conf/vhosts/vhosts.conf:
AllowOverride not allowed here


So..... How do I allow AllowOverride =)..

bathory 03-07-2005 07:47 AM

You have to put it inside the <Directory ...> </Directory> in your vhost definition, like this:
Code:

<VirtualHost *>
        ServerName mydomain.com
        DocumentRoot /var/www/localhost/www.mydomain.com
        ...
        <Directory /var/www/localhost/www.mydomain.com>
            AllowOverride AuthConfig
        </Directory>
        ...
    </VirtualHost>



All times are GMT -5. The time now is 04:32 AM.