Password-protecting a directory in cPanel allows you to restrict access to certain areas of your website. When enabled, visitors must enter a valid username and password before accessing the protected content. This feature is useful for securing private sections of your site or safeguarding sensitive data.

 

Steps to Password Protect a Directory

1. Log in to cPanel

  • Open your browser and go to your cPanel login page (for example: https://yourdomain.com/cpanel).

  • Enter your username and password.

  • Click Log in.

2. Open the Directory Privacy Tool

  • In the cPanel dashboard, scroll down to the Files section.

  • Click Directory Privacy (this may also appear as Password Protect Directories on some hosting providers).

3. Choose the Directory to Protect

  • You will see a list of directories from your hosting account.

  • Navigate through the folder structure to find the directory you want to secure.

  • Click the name of the target directory.

4. Enable Password Protection

  • On the directory settings page, click Edit.

  • Check the box labeled Password protect this directory.

  • In the Protected Directory Name field, enter a name or label (for example: Private Area). This is displayed on the login prompt.

5. Create a Username and Password

  • Scroll down to the Create User or Add a New User section.

  • Enter a username and a strong password.

  • Confirm the password by entering it again in the second field.

  • Click Save or Add/Modify Authorized User to store the login credentials.

6. Confirm and Review

  • A confirmation message will appear indicating the user was successfully added.

  • If needed, repeat step 5 to add more users.

  • Return to the Directory Privacy main page to verify the protection is active.

7. Test the Protection

  • Open a new browser tab or window.

  • Visit the protected directory URL (for example: https://yourdomain.com/protected-folder).

  • You should be prompted to enter a username and password.

  • Enter the credentials created in step 5.

  • If login is successful, you’ll be granted access. If not, verify the login information.

Was this answer helpful? 0 Users Found This Useful (0 Votes)