.htaccess on Apache/Win XP (help!)

They have: 12 posts

Joined: Apr 2004

Hello:)

I have Apache 2.0 for Win32 installed on my XP box along with ActiveState's Perl , Sendmail, etc and it all works great. I could'nt be happier!. However, I have tried to get .htaccess working until I am blue in the face and while this is *supposed* to be a simple thing, it has proven to be very problematic for me. What am I doing wrong here please?.

Ok, here's the scoop...

I have my .htpasswd file installed in:

"C:Program Files\Apache Group\Apache2\".

The .htpasswd file contains exactly the following:

shoefly:greenman

I have my .htaccess file installed in the folder I want to password protect. That folder is here:

"C:Program Files\Apache Group\Apache2\htdocs\private".

The .htaccess file contains exactly the following (but I've tried a number of variations):

AuthUserFile /Apache2/.htpasswd
AuthGroupFile /dev/null
AuthName "Sound Effects Library"
AuthType Basic

require valid-user

The only other thing I've done is to change the "AllowOverride" directive in the Apache /conf/httpd file from "None" to "All" (I've also tried others).

My problem is that while the login screen comes up with no problem when I attempt to enter the protected folder, it will not accept the username/password I used in the .htpasswd file. I've tried it encrypted and plain text.

Finally, is that little utility in Apache's bin folder (htpasswd.exe) really necessary in order to create password-protected folders and use .htaccess or can I just do this manually with a few simple text files in NotePad.

Well, Hope I've explained this ok. Thank's in advance for any help on this perplexing issue (I'm getting desparate now!)

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

You need to create the password using the .htpassword utility.

Quote: from Apache's site
To create the file, type:

htpasswd -c /usr/local/apache/passwd/passwords username
htpasswd will ask you for the password, and then ask you to type it again to confirm it:

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

They have: 12 posts

Joined: Apr 2004

mairving wrote: You need to create the password using the .htpassword utility.

I just want to say that I really appreciate your help. I can change the name of the .htaccess file to something like "secure.htaccess" (since I've heard that Windows does'nt like files without a prefix) if you think it would work better. I tried the htpasswd.exe tool but when I ran it (by simply double-clicking it) it brought a DOS screen up for about 2 seconds and then it dissapeared before I was able to read it. Does the password have to be encrypted?. I tried it earlier using an .htaccess online encryption tool but it still did'nt work.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Run it from the command line, Start/Run/cmd...

Welcome to WMF.

They have: 12 posts

Joined: Apr 2004

mairving wrote: Run it from the command line, Start/Run/cmd...

Welcome to WMF.

Thank's for the welcome!. Ok, so in my .htpasswd file, located at...

"C:Program Files\Apache Group\Apache2\"

I have the following...

shoefly:greenman

Now, based on this, what path do I use in the following command I was given earlier? (I don't have a "/usr/local/apache/passwd/passwords" path anywhere on my machine)...

htpasswd -c /usr/local/apache/passwd/passwords username

I assume the "-c" tells Apache that I am using drive c and that the "username" is the username I wish to use, correct?

Thank's again for helping out an .htaccess newbie:)

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Actually you are going to have to change things a little since Windows deals with paths differently:
htpasswd -c "C:\program files\apache group\apache2...\rest of path"
You have to use backslashes and put quotes around it since some of the directories contain spaces.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

They have: 12 posts

Joined: Apr 2004

mairving wrote: Actually you are going to have to change things a little since Windows deals with paths differently:
htpasswd -c "C:\program files\apache group\apache2...\rest of path"
You have to use backslashes and put quotes around it since some of the directories contain spaces.

Well, I managed to bring up the CMD/DOS screen and run the Apache htpasswd utility but I need to be absolutely sure of the path and understand what I'm about to do here. Is the path I am specifying one which goes to the .htpasswd file itself and do I need to include it's name in the path like this...

htpasswd -c "C:\program files\apache group\apache2\.htpasswd"

or like this...

htpasswd -c "C:\program files\apache group\apache2\"

Does the cAsE of the path matter?. Should I give the .htpasswd file a prefix first (ie; secure.htpasswd) because I'm running WinXP?. Finally, after I do this, will I be able to go into this folder and see that the password has been encrypted?.

Sorry for all the questions btw...ahhh!!

Thank's

They have: 12 posts

Joined: Apr 2004

It worked!!...it worked!!!. I'm in seventh heaven!. Thank you everyone:). I've been fighting with this thing for days now!!.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Glad you got it working. As an FYI, the case doesn't matter in Windows but does in 'Nix (Linux, BSD, Unix, Mac).

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.