How do I protect certain directories of my website in CPanel ?

protect certain directories of my website in CPanel.

  1. Bhawani Singh
    If you want to add extra layer of protection to your folders or directories then you can protect your folder through password available in your account. In case if you don’t want to give access to your folder generally to others then you can easily protect your folder through an option “Directory privacy” in cpanel. Your password protected folder will no longer accessed by any one.

    This option will create a rule in .htaccess file and if you want to access those folders then you have to enter proper username and password for it.

    Note : If your password protect folder contains any subfolder in it, then you are not able to access that sub-folder without login credentials. To access those password protect folder you have to enter correct username and password.

    Let’s see how to protect a directory in cpanel :

    1. Login to cpanel.

    2. Click on “directory privacy” icon under Files section.


    3. Now select the directory which you want to protect through password and new screen of “Set permission” will appear.


    4. In the new window enter the name of folder which you want to protect and check the box “Password protect the directory”.


    5. Clik on “Save”.

    6. In this step you have to create user who can access the protected directory.


    7. Click on Save.