Click to See Complete Forum and Search --> : Using a .htpassword file in a windows installation


Anon
07-25-2000, 02:07 AM
I installed apache over windows, and I am trying to use a .htaccess file to password protect a directory. I create my .htpasswd file with the username and the crypted password and I have an .htaccess file like this:

allow from all
AuthType Basic
AuthUserFile c:/home/myweb/cgi-bin/.htpasswd
require valid-user

When I point my browser at http://localhost/ it asks me for the username and password, but it won't accept it. I keep getting an access denied page.

I have tested the same .htpasswd file in an apache server over Linux an it works, what could be the problem with windows?

Anon
07-27-2000, 07:14 AM
A ".htpasswd"-file created on Linux will NEVER WORK IN WINDOWS!!!
The reason is obvious: there's not the same encryption type. Windows uses MD5 and Linx something else.
Try again! You might have luck this time!

Chris

Anon
07-28-2000, 02:51 PM
I tried again using the htpasswd.exe included in the apache distribution, worked like a charm now!! thanks a lot.

Anon
07-28-2000, 04:18 PM
you're welcome. I'm glad to hear that.
good luck!
Chris

Anon
08-08-2000, 01:01 AM
hi, ken

i have installed php3,apache in Window98 and i am looking for the solution same as u( since u have succeed to do it, pls teach me..! thank )

i have created a .htpasswd file by using htpasswd.exe and i stored the file in:
C:\Program Files\Apache Group\Apache\users\.htpasswd

i also have created a .htaccess file and put it into one of the directory in document root..

but i still can access into the directory without any login!
Please..help me !
Thank you very much!

cK

Anon
08-08-2000, 08:39 AM
The .htaccess file need to be in the directory that is password protected. The .htpassword can be anywhere, but you must point to it from the htpasswd

My document root is
c:\www\web\htdocs

In a directory named "private" I placed the .htaccess file, then whenever I want to access that directory it asks me for the username and password. The contents of the htaccess file I have is

allow from all
AuthType Basic
AuthUserFile d:/www/web/htdocs/private/.htpasswd
AuthName "Private area"
require valid-user

and I have the .htpasswd file in the same directory. Hope this example helps.

fotakis
03-21-2001, 08:57 AM
I know this is really stupid, but when I try to create any file beginning with a ".", it does not accept it under windows.

For example I cannot create an ".htaccess" file!!

Also how do you load that password module?


Any help will be very much apreciated.

Thank you very much in advance,
Fotis

Anon
02-11-2002, 08:47 PM
To create a .htaccess or .password file in Windows, make a file called something like "htaccess" and drop to MS-DOS and rename it, e.g. REN htaccess .htaccess

Works a treat.

ikellen
08-29-2002, 08:35 PM
OK I have been screwing with this same thing for days, and I can't get it to work. A friend of mine said you have to modify something in http.conf for apache to comprehend .htaccess on Windows. Any ideas?

piersk
08-30-2002, 05:51 AM
If you put AllowOverride All into the <Directory></Directory> bit in your httpd.conf file, then apache will see the .htaccess file.

Chris: This will work with windows as well as linux.