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.
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.
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.
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.