Password Protecting Your Files
Before you start you
will need a text editor programme (like Windows Notepad or Simple Text)
An htaccess file is
a simple ASCII file, created with a text editor
like NotePad or SimpleText. Many people seem to have some confusion
over the naming convention for the file.
.htaccess is the file extension.
It is not filename.htaccess or somepage.htaccess, it is simply named
.htaccess. In order to create the file, open up a text editor and save an empty
page as .htaccess. Chances are that your editor will append
its default file extension to the name (e.g. for Notepad it would call
the file .htaccess.txt). You must remove the default .txt or whatever
file extension it applies.
1. Create a file called ".htaccess" using
a text editor, the contents of your .htaccess file should look
something like this:
order allow,deny
allow from all
require valid-user
AuthName "My Password Protected Folder"
AuthType Basic
AuthUserFile /home/<username>/public_html/<folder>/<pwd file> |
Create this file and upload it to the web folder that you want to
protect.
2. Create the password file. You must use the same filename which
you specified in your ".htaccess" file above for "<pwd
file>". Your password file will look something like this:
admin:Dj30hf/3kHduhf
The username is specified on the left of the ":" and the
password is on the right of the ":". Notice that the password
must be encrypted. Use the box below to generate the encrypted password
for use in your password file:
Instant Password Encryption for use with .htaccess files
3. Once you have created your password file, upload it to the folder
you specified in your .htaccess file as "AuthUserFile".
When you attempt to connect to that folder using your browser you
should now see a box appear requesting a username and password for
access to this folder.
|