How to password protect a website folder using .htaccess and .htpasswd
Bonface Maina
Software Developer | web designer | Senior React, Go, Nextjs and Django developer | app developer
To add password protection is quite straightforward
Go to the link below and generate a password that you will use inside your .htpasswd
Note: use the generated hash and username as it is don't use your real password
check the generator tool here at GET TOOL HERE
Create a .htaccess file if it does not exist and add the following
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /home/<your username >/public_html/.htpasswd
Require valid-user
And thats all it requires to protect your folders or websites