Htaccess Auth在两个子域上

时间:2018-03-16 08:31:05

标签: apache .htaccess webserver

我有一个htaccess,现在它看起来像这样:

SetEnvIf Host sub1.domain.de pass1
SetEnvIf Host sub2.domain.de pass2
AuthType Basic
AuthName “Required User“
AuthUserFile usr/var/www/html/.htpasswd
Require valid-user
Order allow,deny
Allow from all
Deny from env=pass1
Deny from env=pass2
Satisfy any

但它并没有真正起作用。

我有6个子域,但我只想要sub1和sub2需要auth。

希望你能帮助我......

1 个答案:

答案 0 :(得分:0)

你应该在.这样的行sub2.domain.de中逃避sub2\.domain\.de SetEnvIf Host (sub1|sub2)\.domain\.de pass 你可以将两个子域组合在一起,如下所示:

“Required User“

然后将此"Required User"替换为此.htpasswd

最后确保AuthUserFile usr/var/www/html/.htpasswd AuthUserFile /path/to/.htpasswd的路径正确并且像SetEnvIf Host (sub1|sub2)\.domain\.de pass AuthType Basic AuthName "Required User" AuthUserFile /path/to/.htpasswd Require valid-user Order allow,deny Allow from all Deny from env=pass Satisfy any

一样

所以,代码看起来像这样:

List<Bean> data = new ArrayList<Bean>();
data.add(new Bean("book","John",59));
data.add(new Bean("book","Björn",61));
data.add(new Bean("tv","Roger",36));
Dataset ds = spark.createDataFrame(data, Bean.class);

ds.show(false);

+------+-------+---------+
|amount|product|purchaser|
+------+-------+---------+
|59    |book   |John     |
|61    |book   |Björn    |
|36    |tv     |Roger    |
+------+-------+---------+


ds = ds.groupBy(col("product")).agg(collect_list(map(ds.col("purchaser"),ds.col("amount")).as("map")));
ds.show(false);

+-------+---------------------------------------------+
|product|collect_list(map(purchaser, amount) AS `map`)|
+-------+---------------------------------------------+
|tv     |[[Roger -> 36]]                              |
|book   |[[John -> 59], [Björn -> 61]]                |
+-------+---------------------------------------------+