How to Password Protect Folders and Files

The best way to restrict access to a folder in your web site is to use password protection. This will only allow people who have been given the user name and password to enter that area of your web site. This is particularly useful for creating a members only area.

Password Protection using Cpanel

If your web site is hosted on a Linux server (most are these days) you will have access to the administration
panel to your web hosting account.

Here are the steps to password protect a folder:

1. Login to your cpanel
2. Within cpanel click on the Password Protect Directories icon.
3. 2 Click on the name of the directory that you wish to protect. (You can navigate to a directory by clicking on the icon next to it).
4. When the new screen appears, click on the box next to the icon to require a password to access the directory.
5. Type the name that you wish to appear in the login box for the directory in the blank field next to Protected Resource Name.
6. Place the name of the user you wish to be able to access the directory in the blank field next to Username.
7. Place the password for that user in the blank field next to Password: and click on Add/Modify authorized user.
8. Repeat steps 5 and 6 as necessary to add more users.
9. To change a user’s password, click on their name, type a new password into the Password field, and click on Change Password.

How to restrict access to the entire web site

All web site files and folders are kept within the public_html folder. To restrict access to this folder follow the 9 steps outlined above. When a person enters the web site address in their browser a box will pop up prompting them to enter a user and password to gain access.

How to Password Protect Multiple Directories

If you need restricted access to multiple directories, create a different user name and password for each directory. If you are the administrator of the web site and need to edit the information in all directories, simply use the same user name and password,
then add add new users and passwords for other people.

Make sure you test your password protected folders before making your web site live.

A note about cache and cookies

Computers store information in their browser’s cache and also through the use of cookies. These may not be erased when you log out of your web site thus leaving the stored information on the computer for others to access without the need to log in.

Use a PHP script if you require more advanced protection.


  1. of online hasardspel…

    expect,personification,confidence backwaters bandied …

Speak Your Mind