How to Password Protect Your Website or Certain Directories


Password protecting a directory is useful when setting up staging sites that are not yet open to the public, and when blocking access to specific pages or information.

How To Password Protect Your Website or a Certain Directory
Step 1 -
Log into cPanel and click on Directory Privacy.

dirprivacy01.png



Step 2 -
Click on public_html.

dirprivacy02.png

Note: If you want to only password protect a subdomain, subfolder or addon domain (eg: test.yourdomain.net.au or yourdomain.net.au/membersarea/ ) you can use this menu to navigate to that folder)


Step 3 -
(1) Tick Password protect this directory (2) Enter a name for your reference (3) click Save.

dirprivacy03.png



Step 3 - Add a user and hit Save

dirprivacy04.png



Now when someone visits your site, they will get this popup before any content loads:

dirprivacy05.png


How To Remove Directory Password Protection
Step 1 -
Log into cPanel and click on Directory Privacy.

dirprivacy01.png



Step 2 -
Find the directory that's password protected (it will have a lock on it) and click on the link (not on the lock).


7f68e23400effe6247cc03917b9b8236ad35b570?t=681cbee025bb40fb3dcd2f7fe386b87e



Step 3 - Untick the box next to Password protect this directory then click Save.


62a9a4a7d9cfd01174d13d5bfec402fc7c9b9025?t=e83694b2daf8529db794810361190687



Thank you for your feedback on this article.