View Full Version : .htaccess/.htpasswd Files not working

07-28-2003, 10:09 PM
I'm running Apache 2.0 on Windows XP and have a .htaccess file in one of my directories. And it contains:

AuthUserFile .htpasswd

AuthName Relay01
AuthType Basic

require valid-user

And the .htpasswd file is in the same directory as the .htaccess file. And when I try to access the directory through the browser, it pops up with a login dialog like it should, but even when I enter in username and passwords that I know are good, it doesn't accept them.

The .htpasswd of course has the username and encrypted passwords.

What is wrong? It is hard to figure it out since all the tutorials on .htaccess I've found are for Linux only.

07-29-2003, 12:25 AM
Some win machines have problems with files beginning with .. The file is there, which is why it doesn't error out, but the system doesn't recognize it. More than a few people who want to run Apache on Windows often setup their htaccess/htpasswd files as ht.access and ht.passwd and then update the httpd.conf file:

AccessFileName .htaccess
AccessFileName ht.access


<Files ~ "^\.ht">
<Files ~ "^ht\.">

This typically resolves the problem.

07-29-2003, 01:18 AM
Well I would be willing to bet the problem lies with the fact that you didn't specify the location of the .htpasswd file.

Since you are on a windows machine your path will look something like this:

AuthUserFile C:\www\protecteddirectory\.htpasswd

AuthName Relay01
AuthType Basic

require valid-user

07-29-2003, 01:22 AM
I did both things and it didn't resolve the problem.

Any other ideas? :confused:

07-29-2003, 01:54 AM
I copied and pasted the contents of your htaccess file and ran it on my machine running Apache 1.3 on WinXP and it works fine.

Do you have your .htpasswd file set up like this?


Oh yeah and undo what feyd suggested so we are at least working under the same condition. Those changes are not needed in this situation.

07-29-2003, 03:33 AM
I re-did the .htpasswd file using the program included with apache. I was using this one site that had the feature, http://www.euronet.nl/~arnow/htpasswd/

But it guess it isn't compatible. Nevertheless, I got it working. Thanks guys.

08-07-2003, 01:26 PM
oracleguy, Is the program you used available on the web? I've been having a problem getting .htpasswd to work also and I was using that same password generator.

08-09-2003, 07:59 PM
The program should come with apache. It is in the bin folder and called htpasswd.exe

You run it from the command line.

08-13-2003, 11:32 AM
I'm not running the webserver myself. I've already asked the host admin and they said that I don't have access to it. They said that I should be able to put in the password just like normal (without encoding it) but that doesn't seem to work either.