I think most of you are aware of http security using .htpasswd. It is the way to secure any directory or domain. I was using it in windows with some htpasswd generator. On unix based system it’s more easier for anyone to secure any directory or webpage.
All you need to do the following:
- Open terminal , you’ll find it under /Application/Utilities (I know you’re aware 🙂 )
- Type a command
$ htpasswd -c /../web/.htpasswd username
- After running the command it’ll ask for your password. The htpasswd for username/password is set for you.
- Now you need to create a .htaccess file at the directory you want to protect , suppose /…/web/.htaccess. Now your .htaccess should have the following lines.
<LIMIT GET POST>
Now save .htaccess and try running the page, You need to provide the username/password you set.
On windows the same process you need to do but need to generate the .htpasswd from any source and create .htpasswd manually then the rest are same.
It’s really easy for Mac Os X.