1) Create the password file .htpasswd
Go to the directory to protect and type in the shell
htpasswd -c -m .htpasswd webuser
-c means create file.
-m MD5 algorithm.
…if you want to get the generated MD5 password in the screen just type
htpasswd -n -bm webuser 123456
2) Create a file .htaccess
AuthName "Restricted Area" AuthType Basic #This is the file you generated before (absolute server path) AuthUserFile /var/www/html/.htpasswd AuthGroupFile /dev/null require valid-user
