Exclude one folder in htaccess protected directory

前端 未结 5 1743
猫巷女王i
猫巷女王i 2020-12-30 00:20

I have a directory protected by htaccess. Here is the code I use now:

AuthName \"Test Area\"
Require valid-user
AuthUserFile \"/***/.htpasswd\"
AuthType basi         


        
5条回答
  •  清歌不尽
    2020-12-30 00:56

    The accepted answer does not seem to run well with new Apache Versions, since it stopped working as soon as Apache Updates were rolled out on some of my customers servers.

    I recommend the following approach:

    AuthType Basic
    AuthName "NO PUBLIC ACCESS"
    AuthUserFile /xxx/.htpasswd
    
    SetEnvIf REQUEST_URI "(path/to/directory/)$" ALLOW
    
    
      Require env ALLOW
      Require valid-user
    
    

提交回复
热议问题