Signup/Sign In
LAST UPDATED: SEPTEMBER 14, 2021

How to Password Protect any Web Page or Directory on cPanel

    In my previous post, I wrote about how to use .htaccess and .htpasswd files for enabling authentication (password protection) on any webpage or on all the web pages of your website. Well, as always, there are many other ways of doing this including a very simple one using cPanel.

    cPanel provides a lot of features which we generally ignore in our daily use. I stumbled upon this feature when I had to restrict access to our testing environment. It's super easy to implement and you can even use it for enabling authentication for your admin panel, restricted web pages, or maybe the development/testing server.

    Follow the steps to password protect any webpage or web directory or the entire website using cPanel:

    1. Login to your cPanel account and click on the option Directory Privacy in Files section.

    password protect directory with cpanel

    2. Choose the folder/directory you want to password protect. If you want to enable protection for the entire website then select the public_html directory or if you want to enable password protection on any particular web page or directory then navigate to it and then click on the name of the directory.

    password protect directory with cpanel

    3. Check the "Password Protect this directory" checkbox and enter a username and password and click on Save. You can also use the password generator to generate a strong password.

    password protect directory with cpanel

    That's it we are done.

    Now whenever someone will try to access the protected directory on a web browser they will have to provide a username and password to access the web pages.

    Hope this article help you and if you face any challenge, feel free to comment down below.

    You may also like:

    I like writing content about C/C++, DBMS, Java, Docker, general How-tos, Linux, PHP, Java, Go lang, Cloud, and Web development. I have 10 years of diverse experience in software development. Founder @ Studytonight
    IF YOU LIKE IT, THEN SHARE IT
    Advertisement

    RELATED POSTS