Exclude folder from htpasswd

Plasticated picture Plasticated · Mar 25, 2012 · Viewed 14.1k times · Source

I need to password protect a website with a username/password but need to keep the "/assets" folder accessible as files like images/css are being embedded on other sites.

I have this for the protection:

Order Allow,Deny
AuthType Basic
AuthName "Password"
AuthUserFile /var/www/.htpasswd
Require valid-user
Satisfy Any

How can I specify to protect everything bar the /assets folder?

Answer

David Wolever picture David Wolever · Mar 25, 2012

You'd use, in a .htaccess file in the assets/ directory:

Satisfy Any
Order Allow,Deny
Allow from all

See the examples here: http://httpd.apache.org/docs/2.2/mod/core.html#require