Use this example to secure access to a website, but allowing at the same time unrestricted access on localhost, for easy development.
This is intended to be used on Apache web server 2.4+.
- Create the .htpasswd fie on your site root folder.
- Edit the file and add as many user:password pairs as you want.
- The password must be encrypted. You can use this site to generate them: http://www.htaccesstools.com/htpasswd-generator/.