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.
Printable View
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.
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.
Here's a nice little tutorial on how to do it.
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. =\Quote:
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!
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:
5.) Reload the directory with the .htaccess file and bam! Job done..Code:AuthType Basic
AuthName "Restricted Files"
AuthUserFile c:/apache_dir/auth/htpasswd
Require user whatever_user_you_made
Now I'm going to sleep...
Sorry I just get very pissed off and frustrated when things dont work right, especially when it has to do with computers.
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:
Upload the file to the directory you would like to secure (in this case: http://yoursite/secured area/)Code:AuthName "secured directory"
AuthUserFile http://yoursite/secured area/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
require valid-user
2. Create a file called ".htpasswd":
Upload it to the same directory.Code:username:password secured with md5
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.
"/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)
READ the tutorial. The file names are ".htaccess" and ".htpasswd", not SOMETHING.htaccess or SOMETHING.htpasswd.
And your avatar is a Linux-pengiun :p