...

View Full Version : My htaccess won't let me in



Heeter
07-29-2007, 11:44 PM
Hey all,

I am trying to lock down a subfolder in my website,

Using the .htaccess tutorial, I managed to get it working, but now, when I enter my username/password, I keep getting the user/pass popup all the time, it does not let me through. If I hit cancel, then it goes 401.

What am I doing wrong or what am I missing?


Thanks,

Heeter

rafiki
07-30-2007, 12:05 AM
move to general web building and post ur htaccess code.

Heeter
07-30-2007, 12:31 AM
Thanks Rafiki

I don't think that I can move this thread, sorry for posting in wrong forum section.

Here is my .htaccess



AuthName "Test Database"
AuthType Basic
AuthUserFile C:/Apache2.2/.htpasswd
AuthGroupFile /dev/null
require valid user



Thanks Again,

Heeter

_Aerospace_Eng_
07-30-2007, 02:06 AM
Not sure what tutorial you followed but this one seemed to work for me http://www.javascriptkit.com/howto/htaccess3.shtml

And its also provided on javascriptkit.com which is a sister site of codingforums.com so its resources are reliable.

Heeter
07-30-2007, 03:33 AM
Thats the one I used,

Thanks Aerospace Eng.

I am not saying that the tut is wrong, I know that I am either missing something, or something is in the wrong place. Just can't quite put my finger on it.

Heeter

_Aerospace_Eng_
07-30-2007, 03:44 AM
Does your webhost not have the option to setup password protected directories? Most hosts do. You should look into it.

Heeter
07-30-2007, 05:16 AM
Thanks for the response,

I actually am my own host, here are my specs:

Windows2003Standard
Apache 2.2
PHP5
MySQL5

Domain: hcctech.ca
Subfolder trying to lock: hcctech.ca/testdb
using "user" for user and "test" for password

This is for testing purposes, once I figure this out, I will setup something more permanent.




Heeter

_Aerospace_Eng_
07-30-2007, 05:25 AM
The last line should be

require valid-user
not

require valid user

Heeter
07-30-2007, 05:44 AM
Thanks, Aerospace.

changed it like you mentioned, but still doing the same thing.

I restarted Apache just to be sure, as well.

Authentication keeps poping up, no matter what I enter, but hit cancel and it goes 401



AuthName "Test Database"
AuthType Basic
AuthUserFile C:/Apache2.2/.htpasswd
AuthGroupFile /dev/null
require valid-user



Thanks,


Heeter

VIPStephan
07-30-2007, 08:39 AM
I suppose it has something to do with the path (in AuthUserFile). Have you checked the directory structure? Is the htpasswd file directly located in C:/Apache2.2? Or is there more like C:/Apache2.2/htdocs or /wwwroot (Iím not so familiar with Apache on Windows).

Heeter
07-30-2007, 11:19 PM
Thanks for the response VIPStephan

the .htpasswd file is in C:/Apache2.2

I have deleted that file and created new ones using the handy-dandy tool of the tut, to no avail. They have all been put there in that directory.

I am now officially pulling my hair out on this one......

Heeter

_Aerospace_Eng_
07-31-2007, 12:05 AM
Put the following in a php file and post what you get

<?php
echo $_SERVER['DOCUMENT_ROOT'];
?>

Heeter
07-31-2007, 12:53 PM
I get this:



E:/


My E drive is my webserver files.

Thanks,


Heeter

_Aerospace_Eng_
07-31-2007, 12:55 PM
That seems to be the issue. I don't think you can use another drive as the location of your htpasswd file. I'm guessing if you put it in the E:/ drive and then changed this

AuthUserFile C:/Apache2.2/.htpasswd
to this

AuthUserFile E:/.htpasswd
It will likely work.

Heeter
07-31-2007, 01:03 PM
Hi,

I made the mods to the htaccess, and moved the htpasswd to the new place, and it is still doing the same thing.


Thanks so far for your help, Aerospace,


Heeter

_Aerospace_Eng_
07-31-2007, 01:05 PM
Try

AuthUserFile .htpasswd
instead.

TheShaner
07-31-2007, 07:23 PM
Also, you have this in your .htaccess file:

AuthGroupFile /dev/null
/dev/null is used in Unix-like OSes for discarding data and such. Windows will not understand that.

Just get rid of that line totally, unless you have a group file. If you have a group file, then provide the path to it rather than /dev/null.

-Shane

Heeter
08-01-2007, 10:53 AM
Thanks for all your responses guys,

I removed the "AuthGroupFile" line. Still doing the same thing.

I am wondering if there is something that needs to be done in the httpd file as well?


This is what my .htaccess file looks like now:



AuthName "Test Database"
AuthType Basic
AuthUserFile C:/Apache2.2/.htpasswd
require valid-user


Thanks,

Heeter

TheShaner
08-01-2007, 02:18 PM
I'm not sure what it could be then.

Maybe start fresh and use this tutorial that is aimed at using Windows and Apache: http://sniptools.com/tutorials/windows-apache-and-htaccess-authentication

-Shane



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum