Protect a location from Apache

By | August 15, 2009

Sometimes, you need to protect a certain location with Http Access and users must enter username and password to view that location.

A simple way to do this is from Apache configuration file or from .htaccess

<Location /my_location>
AllowOverride AuthConfig
AuthName “Please login!”
AuthType Basic
AuthUserFile /passwd/.htpasswd

require valid-user
<LIMIT GET>
require my_user
</LIMIT>
</Location>

Cheers,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.