LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-07-2005, 04:40 AM   #1
rincewind
Member
 
Registered: Mar 2004
Posts: 32

Rep: Reputation: 15
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
 
Old 03-07-2005, 05:37 AM   #2
linuxxed
Member
 
Registered: Feb 2004
Posts: 273

Rep: Reputation: 30
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.
 
Old 03-07-2005, 05:51 AM   #3
rincewind
Member
 
Registered: Mar 2004
Posts: 32

Original Poster
Rep: Reputation: 15
I've already tried that...
Even tried it in a another browser...
So thats not the case..=(
 
Old 03-07-2005, 07:22 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Use the "AllowOverride AuthConfig" directive inside your vhost definition as you do in your DocumentRoot
 
Old 03-07-2005, 07:33 AM   #5
rincewind
Member
 
Registered: Mar 2004
Posts: 32

Original Poster
Rep: Reputation: 15
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 =)..
 
Old 03-07-2005, 07:47 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Apache and .htaccess spud Programming 1 03-17-2005 11:52 AM
APACHE Problem 2 dirs, identical permissions and security contexts, one gives 403? tones Linux - Software 2 03-13-2005 08:45 AM
Apache/2.0.51 .htaccess 2782d4 Linux - Software 2 02-08-2005 12:12 PM
apache .htaccess linuxanswer Linux - General 1 05-01-2004 04:20 PM
.htaccess in apache 2 im1crazyassmofo Linux - Software 1 04-04-2003 01:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration