2017-12-13 56 views
0

https://example.com/xmlにリダイレクトするIISに書き換えルールを書き込む必要があります。URLを書き直すための正規表現

だから
ケース1:https://example.com/test
ケース2:https://example.com/xmlhttps://example.com/[country-lang-token]/test

(例えばhttps://example.com/en-us/testhttps://example.com/fr-fr/test

をリダイレクトすべきです。

書き換えルールの書き方は分かっていますが、正規表現のために固執しています。

答えて

1

あなたのルールは次のようにする必要があります:

<rule name="Redirect to xml" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions logicalGrouping="MatchAny"> 
     <add input="{REQUEST_URI}" pattern="^/test$" /> 
     <add input="{REQUEST_URI}" pattern="^/\w{2}-\w{2}/test$" /> 
    </conditions> 
    <action type="Redirect" url="/xml" /> 
</rule> 

第一の条件は、ケース1のURLですhttps://example.com/test 第2の条件は[country-lang-token]は形式の文字列がある場合2 https://example.com/[country-lang-token]/testためである{two_letters}-{two_letters}

関連する問題