2017-05-31 15 views
0

web.configにURLを取ってhttp://example.org/MySiteなどの書き換えルールを作成し、http://example.orgなどのルートサイトにリダイレクトするようなリライトルールを作成しようとしています。web.configはパスのルールを書き換えます

それはまた、このようなhttp://example.org/csshttp://example.org/jsなどの特定のフォルダを無視すべきです。

<rewrite> 
    <rules> 
     <rule name="root rule" stopProcessing="true"> 
      <match url="^$" /> 
      <action type="None" /> 
     </rule> 
     <rule name="redirect rule" stopProcessing="true"> 
      <match url="(.*)" /> 
      <conditions logicalGrouping="MatchAll"> 
      <add input="{REQUEST_URI}" pattern="^/css" negate="true" /> 
      <add input="{REQUEST_URI}" pattern="^/js" negate="true" /> 
      </conditions> 
      <action type="Redirect" url="/" /> 
     </rule> 
    </rules> 
</rewrite> 

最初のものは根がリダイレクトループにリダイレクトされていないことを確認になり、そうでなければ適用されることがあり、さらにルールの処理を停止し、そしてこれらの2つのルールは、あなたが必要とするすべてである必要があり

<rewrite> 
    <rules> 
    <rule name="enquiry" stopProcessing="true"> 
     <match url="http://example.org/^$" /> <!-- Wrong !! -> 
     <action type="Rewrite" url="/" /> 
    </rule> 
    </rules> 
</rewrite> 

答えて

1

もう一つは除外したいフォルダを除外し、あなたがルートにリダイレクトしたくない複数のフォルダが存在する場合だけ条件に別の行を追加します。

関連する問題