2016-12-09 6 views
1

Default Web Siteとその中にフォルダがあるとします。IIS7のユーザーをIPマスクに応じて2つのフォルダにリダイレクト

大雑把に、ツリーは次のようになります。私は彼らのIPマスクに応じて、私のウェブサイトに別のフォルダにユーザーをリダイレクトしたい

|- Server 
    |- Default Web Site 
     |- folder1 
     |- folder2 

。ユーザーのIPは、のパターンがある場合たとえば

- 10.10.10.* IIS has to redirect to "folder1" 
- 11.11.11.* IIS has to redirect to "folder2" 

これは可能ですか?もしそうなら、どのように?

答えて

2
<rule name="RedirectBySourceIP1" stopProcessing="true"> 
       <match url="(.*)" /> 
       <conditions> 
        <add input="{REMOTE_ADDR}" pattern="10.10.10.(.*)" /> 
        <add input="{URL}" pattern="folder1(.*)" negate="true" /> 
       </conditions> 
       <action type="Redirect" url="/folder1" /> 
      </rule> 
<rule name="RedirectBySourceIP2" stopProcessing="true"> 
       <match url="(.*)" /> 
       <conditions> 
        <add input="{REMOTE_ADDR}" pattern="11.11.11.(.*)" /> 
        <add input="{URL}" pattern="folder2(.*)" negate="true" /> 
       </conditions> 
       <action type="Redirect" url="/folder2" /> 
      </rule> 
関連する問題