Published March 26th, 2004 by Jim O'Halloran
Setting up .htaccess and passwords
I needed to set up an Apache virtual host with a password today (i.e. a password is required to view the site), and found this handy tutorial from yolinux.com called “Linux Tutorial - Apache Web Server Configuration: Adding password protection to a web site“.
This tutorial applies to Apache based web servers. It requires:
1. Editing the server configuration file (httpd.conf) to enable/allow a directory structure on the server to be password protected. Basically the default
access permission statement need modification.
2. The creation and addition of two files specifying the actual logins and passwords. (.htaccess and .htpasswd)
Worked good as gold for me, the only minot hiccup was that I had to use “/usr/local/apache2/bin/htpasswd” instead of just “htpasswd” as it appears in the tutorial. All in all, very easy to do.