How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

February 5, 2019

How to exclude subfolder from password protection with .htaccess

Filed under: Linux — Tags: , , , , , — admin @ 1:38 pm

So if you want to protect a website with .htaccess and .htpasswd basically you will use

AuthType Basic
AuthName “Password Protected Area”
AuthUserFile /path/.htpasswd
Require valid-user

If you want a subdirectory to be excluded from auth like .well-known , for lets encrypt then a easy way it to create a .htaccess on .well-known directory and place in it

Satisfy any

Other version is to insert into vhosts

<Location /.well-known>
    Require all granted
</Location>

Another one is to add

SetEnvIf Request_URI “path/to/excluded/directory/” allow
SetEnvIf Request_URI “path/to/excluded/file” allow
Order allow,deny
Allow from env=allow
Satisfy any

And anothe one is to add

Require expr %{REQUEST_URI} =~ m#^/.well-known/acme-challenge/#

Before require valid user

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress