2017-02-28 38 views
1

私はとどまるべきhttp://myurl.com/path/to/old http://myurl.com/path/to/newIISのweb.configリダイレクト特定のURLのルールではなく、他

しかしhttp://myurl.com/fr/path/to/old

http://myurl.com/cn/path/to/old

にweb.configファイルにリダイレクトルールを追加したいです同じ。どのように私は一致/ルールでそれを達成することができますか?

+0

使用asp.net MVCルート属性を。 –

+0

このページをチェックするhttps://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module –

答えて

1

は、あなたのweb.configファイルにこれを追加します。

<rewrite> 
    <rules> 
    <rule name="Redirect old to new" stopProcessing="true"> 
     <match url="^path/to/old" ignoreCase="false" /> 
     <conditions> 
     <add input="{URL}" pattern="^fr/.*" ignoreCase="false" negate="true" /> 
     <add input="{URL}" pattern="^cn/.*" ignoreCase="false" negate="true" /> 
     </conditions> 
     <action type="Rewrite" url="/path/to/new" /> 
    </rule> 
    </rules> 
</rewrite> 
関連する問題