Page 1 of 2

.htaccess file not working

Posted: Fri Jun 30, 2006 5:31 pm
by Burrito
I'm a complete friggin newb to *nix and a relative newb to apache. I have successfully set up an .htaccess file on a windows box with apache to restrict access to a folder and am trying right now to do the same on a *nix box with no success.

here is what my .htaccess file looks like:

Code: Select all

AuthName "restricted database"
AuthType Basic
AuthUserFile /usr/local/httpd/users

require valid-user
I used htpasswd to create my users file and it worked fine

I also changed the AllowOverride directive in httpd.conf to AuthConfig from none.

restarted apache and tried to access a file in my folder with the .htaccess file and it let me right through...what am I missing?

Posted: Fri Jun 30, 2006 6:19 pm
by Burrito
I've also tried using the standard file name .htpasswd instead of users....no luck

Posted: Sun Jul 02, 2006 5:55 pm
by Burrito
Image

Posted: Wed Jul 05, 2006 10:36 am
by Burrito
Image Image Image

sorry to keep bumping this but I really need a resolution here and I'm at a complete dead end...

Posted: Wed Jul 05, 2006 10:49 am
by Benjamin
Windows doesn't like files starting with a .

Try putting a few characters in front of it and changing your apache config file to reflect the change. Then restart apache.

Posted: Wed Jul 05, 2006 11:08 am
by Burrito
this is on a *nix box...not windows.

Posted: Wed Jul 05, 2006 11:13 am
by Benjamin
Oooh I saw windows and could have sworn... anyway, it's gotta be something in the apache config file... If the file is there and formatted correctly there is no reason why it shouldn't work... Not that I can think of anyway..

Unless it's a permission's issue? Can apache "read" the file?

Posted: Wed Jul 05, 2006 11:18 am
by RobertGonzalez
I am not that proficient in Apache to know the exact directives, but this thread had some decent information;

http://www.dynamicdrive.com/forums/arch ... -8592.html

Also, the Apache tutorial on .htaccess has some good information.
Also, are the file permissions for the .htaccess file correct? And is it in the folder that you want to protect? I know those are basic questions, but it never hurts to ask.

Posted: Wed Jul 05, 2006 11:23 am
by Burrito
that's just it...I don't think it's even reading the .htaccess file, but I don't know a way I can make that determination for sure.

Posted: Wed Jul 05, 2006 11:29 am
by Burrito
Everah wrote: Also, are the file permissions for the .htaccess file correct? And is it in the folder that you want to protect? I know those are basic questions, but it never hurts to ask.
yes (777) and yes :)

Posted: Wed Jul 05, 2006 11:30 am
by JayBird
Have you got the correct setting for the AllowOverride bits of the httpd.conf?

Posted: Wed Jul 05, 2006 11:30 am
by Burrito
yup, I have it set for 'AuthConfig'

Posted: Wed Jul 05, 2006 11:33 am
by JayBird
I normally have this line

Code: Select all

AuthUserFile /usr/local/httpd/users
setup like this

Code: Select all

AuthUserFile /usr/local/httpd/users/.htpasswd
This is one of mine that i use

Code: Select all

AuthUserFile /home/virtual/site412/fst/var/www/.htpasswd
AuthGroupFile /home/virtual/site412/fst/var/www/.htgroup
AuthName "ClientName"
AuthType Basic
<Limit GET>
require group  ClientName
</Limit>

Posted: Wed Jul 05, 2006 11:36 am
by Burrito
yeah if you read my second post, I've tried that as a file name as well...no luck:

I've now tried creating another <Directory> in my httpd.conf file and pointed it explicitly to the location of the folder in question and used AllowOverride AuthConfig...still no go! GRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR!

Posted: Wed Jul 05, 2006 11:41 am
by RobertGonzalez
Another simple question... is the folder name spelled the same (case-wise) in the .htaccess as it is in the folder tree?