Search code examples
apache.htaccess.htpasswd

Exclude folder from htpasswd


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?


Solution

  • 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