Some times you may have some content that you want small group of people to view it in your application.
The Apache allows you to protect directories with the .htaccess and .htpasswd configuration files so any one request a file from it will prompet a box with username and password.
FIRST we need to make a password file (should be somewhere not accessible from the web ).
# htpasswd -c /home/.htpasswd demo (this will create the file in home directory)
and it will ask you for a password and confirmation
SECOND go to the folder that you want to protect Ex(
create .htaccess file and place the following:
AuthUserFile /home/.htpasswd -password file
AuthName “restricted area” -description will appear in login screen
and we are done , go to the required path and enter your credential.
note: you will need to AllowOverride directive