How to Password Protect Your Website or Directories Using cPanel

Sometimes, site owners may want to restrict access to their entire website or specific sections, pages, or folders, allowing only designated users to view them. This can be done by password-protecting a directory or page.

While it’s possible to manually configure this using .htaccess and .htpasswd files, the easier and more user-friendly method is to use cPanel’s built-in password protection feature. This guide will walk you through enabling and removing password protection in cPanel.

Step 1: Log in to cPanel

  1. Open your web browser and go to your cPanel login page, usually something like:
    http://yourdomain.com/cpanel
  2. Enter your username and password to log in.

Note: The cPanel interface may vary slightly depending on your hosting provider or the version of cPanel.

Step 2: Access Directory Privacy

  1. On the cPanel home page, locate the Files section.
  2. Click on Directory Privacy (or a similar option).
  3. You will see a list of directories on your website.

Step 3: Select the Directory to Protect

  1. Find the directory you want to protect and click the Edit button next to it.
    • To protect your entire website, select the root folder.
    • To protect a specific section, browse to the sub-directory you want to secure.

Step 4: Enable Password Protection

  1. On the next page, check the box for Password protect this directory.
  2. Enter a name for the protected directory. This name will be displayed to users when they are prompted to enter credentials.
  3. Click Save to enable password protection.

Step 5: Create User Accounts

  1. After enabling password protection, click Back to return to the Directory Privacy page.
  2. Click the option to create a user and password for the directory.
  3. Enter a username and password for each user who should have access.
  4. Click Save to create the user accounts.

Now, anyone trying to access the protected directory will be prompted for the credentials you created. Only authorized users will be able to view the content.

Step 6: Remove Password Protection

If you later decide to remove password protection:

  1. Go to cPanel > Files > Directory Privacy.
  2. Locate the protected directory and click Edit.
  3. Delete all the users you created.
  4. Uncheck the Password protect this directory option.
  5. Click Save to disable password protection.

Key Takeaways

  • cPanel makes it easy to secure your website or specific folders without manually editing server files.
  • Always create strong passwords for your protected directories.
  • You can enable and disable protection at any time depending on your access needs.

By following these steps, you can ensure sensitive sections of your website are only accessible to the people you choose.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top