Learn more about the world's best-loved Web server, with examplesof Apache's authentication and logging capabilities, and also pay a briefvisit to its unique URL re-writing module.
In addition to user-level access, Apache also allows you to createdifferent groups of individual users, and restrict access to protectedresources based on group membership. For example, let's assume that I havetwo groups, "accounts" and "admin", and I would like to restrict access toa directory only to members of the "accounts" group.
The first thing to do is change the ".htaccess" file in the directory toread
Next, you need to create the group memberships file, as specified in theAuthGroupFile directive above. This file is extremely simple - here's whatit looks like:
$ cat groups
admin: bill harry
accounts: joe beth
Translation: users "joe" and "beth" are members of the group "accounts",while "bill" and "harry" are members of the group "admin".
Now, when you navigate back to the protected directory in your Web browser,Apache will again ask you for authorization; however, only members of thegroup "accounts" will be permitted to view the contents of the directory.
Finally, you can allow or deny access based on host names - the followinglines would deny access to the protected resource for all requests fromdomains other than "melonfire.com"
order deny,allow
deny from all
allow from melonfire.com