Htaccess

From Blackcannon wiki

Step 1: Edit /etc/httpd/conf/httpd.conf (make a backup copy first). Add the following for the directory you want to protect using .htaccess

<Directory "/var/www/website.com/htdocs/restricted">
deny from all
Options ExecCGI Indexes
AllowOverride AuthConfig
AllowOverride All
Order deny,allow
</Directory>

Now you will want to create a .htaccess file to password protect the Vqadmin interface. There should already be a .htaccess file in the vqadmin directory, so all you need to do is configure it. We'll use the ever useful vi editor for this.

nano .htaccess

AuthType Basic
AuthUserFile /path/to/where/you/want/to/store/the/password/file/.htpasswd
AuthName vQadmin
require valid-user
satisfy any

chown apache .htaccess (you may need to change the chown to either "nobody", "apache" or "www" etc., depending on what user your installation of Apache is running as)

chmod 644 .htaccess

Now you need to create a corresponding .htpasswd file that's going to contain the username and encrypted password for the Vqadmin administrator...

htpasswd2 -bc /path/to/where/you/want/to/store/the/password/file/.htpasswd admin admin_password
chmod 644 /path/to/where/you/want/to/store/the/password/file/.htpasswd