apache2: Require valid-user for everything except "special_page"

Posted by matt wilkie on Server Fault See other posts from Server Fault or by matt wilkie
Published on 2009-12-23T22:43:15Z Indexed on 2010/05/29 0:02 UTC
Read the original article Hit count: 410

Filed under:
|

With Apache2 how may I require a valid user for every page except these special pages which can be seen by anybody?

Thanks in advance for your thoughts.


Update in response to comments; here is a working apache2 config:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    Order allow,deny
    allow from all
</Directory>

# require authentication for everything not specificly excepted
<Location / >
    AuthType Basic
    AuthName "whatever"
    AuthUserFile /etc/apache2/htpasswd
    Require valid-user
    AllowOverride all                       
</Location>

# allow standard apache icons to be used without auth (e.g. MultiViews)
<Location /icons>
    allow from all
    Satisfy Any
</Location>

# anyone can see pages in this tree
<Location /special_public_pages>
    allow from all
    Satisfy Any
</Location>

© Server Fault or respective owner

Related posts about apache2

Related posts about authentication