Follow the steps below to Protect a Directory Using .htaccess on Apache level
open .htaccess file AND add below code
Place this .htaccess file inside directory want to password protected. So, you have to place .htaccess file inside each directory want to password protected.
AuthName "Admin Area" AuthType Basic AuthUserFile /path/to/your/directory/where/.htpasswd/file/present require valid-user
Note: you will have to modify 1st and 3rd line from the above code as per your situation. Continue reading