How to Password Protect a directory in cPanel

Password Protect Directories is a feature of cPanel which provides you the ability to set a password for directories and folders of your website.

It is important to protect your directory with password for privacy and security purposes.

How Does Password Protect Directory Works?

When you will set a Password protect directory, cPanel automatically creates a rule in .htaccess file. This rule specifies that the directory folder is protected and the user can get access to its directory files, folders and subfolders by using a specific username and password set by the user while applying password protection.

Please follow the below mentioned steps for applying Password Protection on a directory folder in cPanel:

1) Login to your cPanel.

2) Scroll down to Security section and click on “Password Protect Directories” icon.

After clicking on Password Protect Directories a pop up window will be appeared from which you have to select the directory that you want to navigate.

3) You are redirected to password protect directory page where you will see a list of directories.

Select and click the directory on which you want to apply Password Protection.

4) After clicking on that particular directory you are redirected to a page where you want to set the security settings and create user.

In Security Settings, you can provide a name to the folder for which you have set password and after that click on "save" button to save the changes.

In Create User, you have to create a new user by setting a username and password for accessing your directory and after that click on "Add/Modify authorized user" for creating a new user.

5) Now if you want to open your website directory in any web browser you will be require to enter the login details that you have set while password protection.