Password Protecting Directories In Cpanel

Password protecting a directory restricts access to certain parts of your website by requiring visitors to enter a username and a password. This password process is also referred to as a type of “authentication” process.

Note: Any subdirectories inside the selected directory will also be password protected.



Password Protect a Directory

To password protect your directory:

Select the directory in which you wish to begin working in the pop-up window.

  1. Select the Password Protect Directories icon from your cPanel main page. A list of the directories on your account will appear.

  2. Select the directory you wish to protect from the list. (While using this feature, navigate the directories by clicking the folder icon located next to the name of the directory. Clicking on the name of the directory will select the directory for password protection.)

  3. Using the Name the protected directory field, assign a name to the password protected directory. (This is the name visitors will see. It can appear as anything, no matter what the directory is called.)

  4. Click Save.

  5. Access your password protected directory via ftp and add the following line to the top of the .htaccess file (you will need hidden folders to be visible):
    ErrorDocument 401 default

After you complete this process, you will need create a user and password using the Create User section of this interface.


Create a User

  1. Enter the username, new password, and password confirmation in the appropriate boxes.

  2. Click Add/modify authorized user.

Note: The new user's name will be added to the listbox under the Authorized Users heading, where it can be removed later.


Remove a User

To delete password protection for a user:

  1. Select the desired account name in the listbox beneath the Authorized Users heading.


  2. While the name is highlighted, click the Delete User button to delete the account.


Remove Password Protection

  • To remove password protection from the directory, uncheck Password protect this directory.

Resolve Page Redirect Issue

Sometimes a page redirect loop stops you from accessing the protected directory. In this case simply add the following line to the top of the .htaccess file inside the directory using an ftp client such as filezilla.

ErrorDocument 401 default

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How do I configure my default email address for misrouted mail?

Easy as Pie.  Just follow these steps: Login to cPanel. Locate and click on the "Default...

How do I create a mailing list?

Mailing lists are usefull if you need to send emails to a lot of people at once.  If your...

Powered by WHMCompleteSolution