Sometime you may wish to protect certain pages/sites from the general public (for site testing, paid purposes, etc.) and you want to add a password to keep users from accessing the page. Here's how you can do that in cPanel:
Log in to cPanel
Open your web browser and type in your domain followed by /cpanel. Next, enter your login credentials (username and password) to enter the cPanel dashboard window.
Find and open the directory privacy
Scroll to the Files section in the dashboard. Next, click Directory Privacy (or Password Protect Directories in some versions).
Select a directory with a page for protection
Locate the folder with the page you plan to restrict through the Directory Privacy interface. Place the page into a separate folder and rename its directory accordingly. Click on the folder with the page to open its settings.
You can also select the entire directory to password-protect everything, including pages.
Enable password protection
Check the box labeled ‘Password Protect this directory.’ Continue by entering the name for your newly-protected directory in the field provided. Next, click ‘Save’ to reveal a confirmation message indicating successful password protection for the selected directory.
Create authorized users
After saving protection settings, scroll to the ‘Create User’ section. Enter a username and password in the provided fields. Type the desired password twice in the spaces provided to confirm it. Tap ‘Save’ to add the user.
A confirmation message listing the new user under ‘Authorized Users’ will appear. You can repeat the process to add more users if necessary.
Verify protection
Open a new window on your browser. Go to the protected page’s URL.
You should receive a prompt to enter the login credentials (username and password) of any account created under the ‘Authorized Users’ section. Entering the correct credentials will grant you access to the directory and its content.
