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:
- sub1.domainname.com
- sub2.domainname.com
- sub3.domainname.com
- exclude.domainname.com
- sub4.domainname.com
- ...
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
Post a Comment