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.

AccessFileName .htaccess

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

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

Create the password file
htpasswd -m /www/htdocs/htpasswd.users user
Leave A Reply - 2 Replies
Anonymous 2002-03-04 10:52pm - No Email - Logged IP: unknown

No shit. You didn't know that? :P

Anonymous 2002-03-05 08:50am - No Email - Logged IP: unknown

No I knew that... I just put a lot of code examples here for later. So if I ever need to reference how I did it, it's just a quick search away.

All content licensed under the Creative Commons License