IIS7でリダイレクト(301)するにはどうすればよいですか?web.configの書き換えルールを使用して、リンクフォーム「domainA.com/link_A」を「domainB.com/link_B」にリダイレクトしようとしています。選択したリンクに対してこれを行うにはどうすればよいですか?そうですか?
<rule name="redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domainA.com/link_A$ />
</conditions>
<action type="Redirect" url="http://www.domainB.com/link_B{R:0}" redirectType="Permanent" />
</rule>
HTTP_HOSTはドメイン名とのみ一致するため、「link_A」の部分をURLに移動する必要があります。したがって、ルールは次のようになります。
<rule name="rewriting" stopProcessing="true">
<match url="link_A" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domainA.com$" />
</conditions>
<action type="Redirect" url="http://www.domainB.com/link_B{R:0}" redirectType="Permanent" />
</rule>
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加