-
September 23rd, 2004, 04:15 AM
#1
Member
Password Protect/.htaccess
How do I password protect some files/folders so that the random user doesnt download something. I was told .htaccess but I dont know how to use that.
-
September 23rd, 2004, 04:22 AM
#2
Using the htpasswd program in your bin folder, create a password file for whatever user you want in a folder named auth in your main Apache folder... then fire up Notepad or whatever and create a ".htaccess" file for whatever directory you want protected (save it in that directory as ".htaccess").
Code:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile c:/apache_dir/auth/htpasswd
Require user whatever_user_you_made
[edit]
Made some corrections to clear up what I wrote.
-
September 23rd, 2004, 04:24 AM
#3
Here's a nice little tutorial on how to do it.
-
September 23rd, 2004, 04:27 AM
#4
Hey phil,
I hate to be a jerk and just say use Google, but I honestly knew nothing about the .htaccess file until like 10 minutes ago. I read some stuff on the first google link. (check out http://www.javascriptkit.com/howto/htaccess3.shtml )
Among other things this explains how it is used to set permissions on folders. I think this will get you started. Good luck!
\"When you say best friends, it means friends forever\" Brand New
\"Best friends means I pulled the trigger
Best friends means you get what you deserve\" Taking Back Sunday
Visit alastairgrant.ca
-
September 23rd, 2004, 04:38 AM
#5
Originally posted here by Algaen
Hey phil,
I hate to be a jerk and just say use Google, but I honestly knew nothing about the .htaccess file until like 10 minutes ago. I read some stuff on the first google link. (check out http://www.javascriptkit.com/howto/htaccess3.shtml )
Among other things this explains how it is used to set permissions on folders. I think this will get you started. Good luck!
Bah, I'll stick up for him... sometimes even finding an article online about you're looking for doesn't help you as much as talking to an actual person... especially when doing it for the first time.... let it go. =\
-
September 23rd, 2004, 04:48 AM
#6
Ok, open cmd and do as follows:
1.) CD into Apache's bin directory.
2.) Type "htpasswd -c C:\wherever\apache\is\auth\htpasswd user_name"
3.) Now open Notepad and create a file called ".htaccess" and save it in the directory (htdocs main folder or whatever subdirectory you want) you want to protect with a password. Make sure the ".htaccess" file has the following:
Code:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile c:/apache_dir/auth/htpasswd
Require user whatever_user_you_made
5.) Reload the directory with the .htaccess file and bam! Job done..
Now I'm going to sleep...
-
September 23rd, 2004, 05:21 AM
#7
Member
Sorry I just get very pissed off and frustrated when things dont work right, especially when it has to do with computers.
-
September 23rd, 2004, 05:50 AM
#8
1. Create a file called ".htaccess" (htaccess is the actual file extension... don't give it another one). In that file, place the following information:
Code:
AuthName "secured directory"
AuthUserFile http://yoursite/secured area/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
require valid-user
Upload the file to the directory you would like to secure (in this case: http://yoursite/secured area/)
2. Create a file called ".htpasswd":
Code:
username:password secured with md5
Upload it to the same directory.
And here's a little tool do to the md5-encryption for the password.
That's basically it. READ that link I gave you for the details.
-
September 23rd, 2004, 06:13 AM
#9
Member
"/dev/null" I dont use Linux.
If .htacess is the file extension, what is the file name. Anything?
Edit: I think I did everything just how you said and it didnt work. I made new text documents and saved them with those extentions, both with the name of admin. (admin.htaccess, admin.htpasswd)
-
September 23rd, 2004, 06:33 AM
#10
READ the tutorial. The file names are ".htaccess" and ".htpasswd", not SOMETHING.htaccess or SOMETHING.htpasswd.
And your avatar is a Linux-pengiun
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|