Web development, coding & SEO


Password protect folders

You need 2 files, named .htpasswd and .htaccess

.htpasswd

.htaccess

AuthUserFile /home/john/.htpasswd
AuthGroupFile /dev/null
AuthName "foo"
AuthType Basic
<Limit GET>
	require valid-user
</Limit>

Place this .htaccess file in to the folder you want protect, sample: /var/www/sample.com/my-protected-folder/.htpasswd (http://sample.com/my-protected-folder/)

Apache conf

Ensure that the Apache conf file something /etc/apache/apache.conf contains a declaration:

<Directory "/var/www/sample.com/my-protected-folder">
	AllowOverride All
</Directory>

Tags: .htpasswd, htpasswd generator, htpasswd tutorial, htpasswd htaccess, htpasswd file, htpasswd example, htpasswd howto.

2010