I have installed apache2 in my server(subDomain.myserver.com) and i placed more folders in /var/www path. I want to do that when the user access subDomain.myserver.com/privateFolder then it should ask password prompt, if the password is valid then show the contents inside the private folder.
Note : I am using linux ubuntu for my server.
How to achieve this?
I tried based on answer :
sudo htpasswd -c /home/user/.htpasswd somename
and then
vi .htaccess
and added lines like below,
AuthName "Secure folder"
AuthType Basic
AuthUserFile /home/user/.htpasswd
require valid-user
and then i moved that .htaccess file into /var/www/protectedContentsHere/.htaccess
But still i can access that all folders inside /protectedContentsHere without prompt box.
where am i doing wrong?