In this tutorial:

If you want to have a folder (or a directory) of your website password protected so that only people you allow can visit a page, you can add a password to the folder in your cPanel. In this article we'll show you how to setup password protection.

As password protection is sometimes a temporary solution, we'll also show you how to remove password protection. If you are looking to password protect a single file, please see our other article: Password protecting a single file in .htaccess.

How to Password Protect a Directory

  1. Login to your cPanel
  2. In the Security section, click the Password Protect Directories button:
    passwordprotect1
  3. A popup box will display asking which directory to open. Select the Web Root option and click on Go:
    passwordprotect2
  4. From the list, choose the folder that you want to password protect. If you want to protect one of the folders listed in your public_html folder, simply click on the name of the folder. If you want to open a folder to protect a directory within a folder, click on the folder icon next to the folder you want to open. In this example, we will password protect the "calendar" folder by clicking on the folder link:
    passwordprotect3
  5. Click the box that says password protect this directory and then name the directory. After you have put in a name for the directory, click on Save:
    passwordprotect4

    A page will come up that confirms that it has been added.
  6. Go Back to the previous page and under the Create User section, you can add usernames and passwords to access the password protected directory:
    passwordprotect4.2
  7. After you have created the user, it will display under Authorized Users:
    passwordprotect5

How to Remove Password Protection from a Directory

There are some scenarios in which password protecting a directory is a temporary solution. For example, if you are testing a new site, you may block access to it until you are ready to launch the site. When you're ready to launch the site, you will need to remove the password protection. To do so:

  1. Log into your cPanel
  2. Click the Password Protect Directories icon, choose Web Root (if prompted), and click Go
  3. Navigate until you see the folder you previously password protected. To navigate through folders, click the folder icon next to the folder name.
  4. When you find the folder that has been password protected, click the folder name to select it (instead of the folder icon next to it)
  5. Uncheck the box that says Password protect this directory and click Save.

Congratulations, now you are familiar with the process of password protecting a directory, and removing the password protection.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.