Authentication through Htaccess
#Shell> vi .htaccess
AuthUserFile /public_html/private/.htpasswd AuthName "Secret Stuff" AuthType Basic require valid-user
Authentication for Single File access on Apache (Linux) through htaccess
Edit httpd.conf file and add below line
Step 1: Add the following lines under htaccess details
Files “awstats.pl”> ### I am adding this to pl extension file you can use and file extension whatever you need.
AuthUserFile /path/to/.htpasswd ### Path where authentication check for password
AuthGroupFile /path/to/.group ### Add group file you want to add multiple users instead single user
AuthName “Restricted Area For Customers” ### This is only name whcih display while login in
AuthType Basic ###
require user Username ### Replace username with user you want to give access
</Files>
Step 2: Save the conf file and exit
Step 3: reload / restart apache on your server
Step 4: create password for users from below command
htpasswd -c .htpasswd username (Add username which you have inserted in conf file.)
Step 5: check from browser if you are able to login with user to whom you have give permission (If it works then everything you need is correct).