Apache User Restrictions

Just had to restrict a directory with a username and password on one of the Apache servers we run. A couple config changes and a quick command and you're done. Here's the quick and dirty version.

httpd.conf
AccessFileName .htaccess

<Directory "/www/htdocs/">
	AllowOverride AuthConfig
</Directory>

.htaccess
AuthName "Server Access"
AuthType Basic
AuthUserFile /www/htdocs/htpasswd.users
require valid-user

Create the password file
htpasswd -m /www/htdocs/htpasswd.users user


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.147.86.143
To prevent spam please submit by clicking the kitten: