PDA

View Full Version : Password Protect a single .html file???


Aaron
02-08-1999, 05:53 PM
Hi,
I need to know if you can password protect a single .html file using the .htaccess file. If this is possible, what should the .htaccess file contain?

Thanks for your help!
Aaron

Deb
02-08-1999, 11:27 PM
Yes, you can http://www.aota.net/ubb/wink.gif

The htaccess file should look something like this:
<Files file_to_protect.html>
AuthUserFile /big/dom/xwhatever/.../.htpasswd
AuthName The_Secret_Page
AuthType Basic
<Limit GET POST>
require user username
</Limit>
</Files>

To create an .htpasswd file, go to the directory you specified in AuthUserFile. Then use the htpasswd program with the -c switch to create your .htpasswd in the current directory. (You have to do this in telnet)

Type htpasswd -c .htpasswd username to create the file and add "username" as the first user. The program will prompt you for a password, then verify by asking again. You will not see the password when you type it in.

To add more users, use the same command without the -c switch: htpasswd .htpasswd terra will add username "terra" to your .htpasswd file. (You would also need to add require user terra to the htaccess file)

To delete users, open the .htpasswd and .htaccess file in a text editor and delete the appropriate lines...

Hope this helps
Deb


[This message has been edited by Deb (edited 02-09-99).]