我正在运行一个mutlisite TYPO3-Site。
对于预生产过程,我想为3/4站点添加htaccess
和htpasswd
。
如何配置htaccess文件以仅针对特定网址触发身份验证?
例如:
http://example.org不应该获得密码保护, 而http://example2.org应该。
两个站点都位于同一台服务器上,由CMS处理。
由于通常的htaccess-stuff看起来像这样:
AuthUserFile /path/to/my/.htpasswd
AuthGroupFile /dev/null
AuthName "Geschützter Bereich"
AuthType Basic
<Limit GET>
require valid-user
</Limit>
它会触发每个网站。
感谢您的任何建议。
答案 0 :(得分:1)
除非主持人在example2.com结束,否则这将授权。
# set the "require_auth" var if Host ends with "example2.com"
SetEnvIfNoCase Host example2\.com$ require_auth=true
# Auth stuff
AuthUserFile /var/www/htpasswd
AuthName "Password Protected"
AuthType Basic
# Setup a deny/allow
Order Deny,Allow
# Deny from everyone
Deny from all
#except if either of these are satisfied
Satisfy any
# 1. a valid authenticated user
Require valid-user
# or 2. the "require_auth" var is NOT set
Allow from env=!require_auth