Click to See Complete Forum and Search --> : .htaccess file


traiviet
04-21-2002, 09:17 PM
Hello All,
I am running Webserver using Apache 1.3.24 on Windows 2000 Pro. The problem is I cannot setup the ".htaccess" file so that I can control certain pages at my sites to be viewed or downloaded by people. Though I have spent countless nights pulling my hair out in order to get it work, but it still does not work. If anyone in here has had that experience, please help. Your assistance is greatly apreciated.
Trai Viet.

P/S: I am totally a novice at Apache server. Thus, your assistance with sequential steps are a lot helpful. Thanks again.

mligor
04-22-2002, 08:32 AM
.htaccess doesn't work if you are not allow that in httpd.conf file

search for
AllowOverride

and change to
AllowOverride All

after that your .htaccess shuld work..

one problem is more with .htaccess, because you can't create file in windows explorer whois start with dot (.), but in dos you can do that, and also you can change that instead .htaccess Apache look in some other file (ex. htaccess.ini) (this is AccessFileName parameter in httpd.conf)

I hope that this will help you.

cu

Anon
04-22-2002, 12:02 PM
Thanks for your help. But I am looking for specific steps to help me out. For example, I have a folder MP3 in my web server, and I really want to protect it. I mean that the user must enter user name and password before he/she can view or download songs from my server. How can I do that? What do I have to write in ".htaccess" file so that it will prompt for password? Please help me step-by-step how to set it up. Again, I am using Windows 2000 Pro. Thanks a lot.

Anon
04-22-2002, 12:55 PM
Hi Again,
Now, I would like to give you what I have done.
I have 1 ".htaccess" file in a folder(test) that I want to protect. Also, I have 1 file called ".htpasswd" which has user names and passwords on it.

Here is I write in the ".htaccess file":

AuthName "Members Only Section"
AuthType Basic
AuthUserFile www.cuongnguyen.dns2go.com/Test.htpasswd
<Limit Get>
require valid-user
</Limit

Also, in the httpd.conf, I change AllowOverride None to AllowOverride All.

However, it still does not work. Please help. Thanks a lot.

Anon
04-23-2002, 11:28 AM
I think you should use
<b>AuthUserFile www.cuongnguyen.dns2go.com/.htpasswd </b>
instead of
<b>AuthUserFile www.cuongnguyen.dns2go.com/Test.htpasswd </b>

a second chance is to change the 1st to lines

Anon
04-23-2002, 11:30 AM
Sorry:

I think you should use
<b>AuthUserFile www.cuongnguyen.dns2go.com/Test/.htpasswd </b>
instead of
<b>AuthUserFile www.cuongnguyen.dns2go.com/Test.htpasswd </b>

ppowell
04-24-2002, 05:17 PM
I can't even CREATE .htpasswd, much less get it to work.. furthermore I read in an Apache document that AllowOverride should be set to NONE in httpd.conf, otherwise, it will look for EVERY occurrence of .htaccess throughout your entire directory tree!

How do I create .htpasswd in Windows 2000 DOS?

Phil

traiviet
04-24-2002, 11:01 PM
I am now having problem exactly like you. I have trouble creating "htpasswd" file. Every time I try to access to the protected folder, it prompts and asks for password. Even though I enter in for user name and password, it says "Forbidden". No permission to access.

I read so many sources online, and I found out that one of the easy way to creat ".htpasswd" file is:

Put username and passoword in that file. For example, if you have username is tester and password for that username is passtest. Then in the ".htpasswd" file, you need to enter:


tester:passtest

By the way, do you know what to put down for
AuthUserFile? Say, I have 1 folder called "Apache_Pass" which contains user name and password in there. And that folder is in C drive. Then in the ".htaccess" file, I do this:

AuthUserFile C:/Apache_Pass/.htpasswd
Is it correct?