Basic Access Control with Apache

Certain parts of your Web site will almost certainly need to be protected from being viewed by the general public; access control allows you to restrict these sections to authorized users either by hostname/IP address, or by password authentication. We'll take a look at both of these methods.

Access Control by Address

Let's say you want to restrict a certain file, directory, or set of files and directories to a short list of fixed IP addresses or hostnames. You can do this at the global (httpd.conf) level; or more efficiently, you can use a .htaccess file in any directory at or above the level of the items you want to protect.

First of all, you need to make sure that .htaccess overrides are enabled in the part ...

Get FreeBSD® Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.