If you want to make your site a password protected. This can be mainly used for under development sites. You want only limited users (admin) should assess the site till it’s on development phase.
You can do this by adding just few lines in you .htaccess file in the directory you are trying to protect.
AuthType Basic AuthName "This Area is Password Protected" AuthUserFile /full/path/to/.htpasswd Require valid-user
You have to create username and password code online from Htpasswd Generator. You’ll get one line code after generating. Like below:
Just put that generated line in your .htaccess file.