2017-08-11 60 views
1

我有兩個域example.comexample2.com。這兩個域指向同一臺服務器,我想啓用http驗證example2.com訪問者只有。我怎樣才能做到這一點?特定域的HTTP基本認證

這裏是我當前的代碼,並從所有參觀者詢問用戶名/密碼:

Authtype Basic 
AuthName "Require Authentication for Example2.com" 
AuthUserFile /var/www/vhosts/<hostname>/httpdocs/<passwd file> 
Require valid-user 

回答

1

您或許能夠實現這一目標使用if directive。因此,如果{HTTP_HOST}等於example2.com,然後使用驗證:

<if "%{HTTP_HOST} == 'example2.com'"> 
    .... 
</if> 

所以,簡單地地方if directive在您的驗證碼。確保在測試之前清除緩存。