【发布时间】:2017-11-17 17:38:50
【问题描述】:
我不完全确定这是否可行,但我有一个托管在几个不同 URL 和几个不同子域上的应用程序。
每个都有一个基本的受保护部分(使用 htpasswd)。
我希望能够拥有一个 htaccess 文件,而不是拥有一堆指向不同文件的不同文件。
我的文件结构如下:
.htaccess .htpasswd-domainone .htpasswd-domaintwo .htpasswd-domainthree
有没有办法做这样的事情?
<If "%{HTTP_HOST} == 'domainone'">
AuthUserFile /file/location/.htpasswd-domainone
</If>
<If "%{HTTP_HOST} == 'domaintwo'">
AuthUserFile /file/location/.htpasswd-domaintwo
</If>
<If "%{HTTP_HOST} == 'domainthree'">
AuthUserFile /file/location/.htpasswd-domainthree
</If>
考虑子域?
【问题讨论】:
标签: apache .htaccess .htpasswd