Directory Login Script


This is how you can password protect a directory on your web server with a .htaccess file. There are two parts to this tutorial.

1) The first thing you will need to do is to setup users that will be able to access the directory.
-a) Go to this website: https://www.kxs.net/support/htaccess_pw.html
-b) Type in your username and password you would like to use and then click the Create Password button.
-c) Copy the line that it makes that should say something like UserName:83jffniu3zwonq
-d) Paste that line into a blank text document (I recommend using Notepad).
-e) Save the file somewhere on the server and remember the filename and path to it. NOTE: Do not put the file in a directory that people can access through the internt!

2) Now that you have made the password file, you need to make the directory inaccessible to people.
-a) Make a new text document (notepad).
-b) Copy and paste this code into the text file:
Code
AuthUserFile */path/to/your/password/file.txt*
AuthGroupFile /dev/null
AuthName *Name*
AuthType Basic

require user *UserName*

-c) Change */path/to/your/password/file* to the actual path to your password file.
-d) Change *Name* to the name of the secure area. For example, "SecureArea" or "Restricted."
-e) Change *UserName* to the user you created.
-f) Save the file in the directory you want to secure and name it ".htaccess"

If you have done this correctly, this will make it so that only the person with the correct login can get into the directory you have sred.

Hope this helps!
Xerofait's Avatar
Author:
Views:
1,764
Rating:
Posted on Thursday 10th January 2008 at 06:55 PM
ShadowMage
ShadowMage's Avatar
wheres part 2?