regex - Restrict Access to one of subdomains, excluding a directory with .htaccess & .htpasswd -


i'm have several websites different subdomains. have common .htaccess file.

example:

  1. sub1.domainname.com
  2. sub2.domainname.com
  3. sub3.domainname.com
  4. exclude.domainname.com
  5. sub4.domainname.com
  6. ...

and restrict access 1 of them, lets exclude.domainname.com.

the problem want allow access different static files may served /files folder (ex: exclude.domainname.com/files/images/image.png).

i've fininshed 1 solution, now, when i'm trying access exclude.domainname.com , after entering username , password i'm getting server error message, static files can accessed without restrictions.

i appreciate help. perhaps probelm setenvif or general logic.

thank in advance.

    ## password protection & authentification ##      authtype basic     authname "access protection"     authuserfile "/path/to/the/.htpasswd"     require valid-user      # exclude environments      # set env deny access     setenvif host ^exclude\.domainname\.com$ deny_access     # remove env deny access     setenvif request_uri "files/*" !deny_access      order allow,deny     allow     deny env=deny_access      satisfy      ## end password protection & authentification ## 

ps:

i tried set different environments allow , deny.

even try deny all, set allow hosts except exclude.domainname.com this:

setenvif host ^(?!exclude)\w+\.domainname\.com$ allow_access 

but without success.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -