IIS 7 将 301 域 A 重定向到域 B
IIS 7 redirect 301 domain A to domain B
如何在 IIS7 中重定向 (301)?
我正在尝试使用 web.config 中的重写规则将 link 从 'domainA.com/link_A' 重定向到 'domainB.com/link_B'。如何为选定的 link 执行此操作?
是吗?
<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>
您需要将 "link_A" 部分移至 URL,因为 HTTP_HOST 仅匹配域名。所以你的规则应该是这样的
<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>
如何在 IIS7 中重定向 (301)? 我正在尝试使用 web.config 中的重写规则将 link 从 'domainA.com/link_A' 重定向到 'domainB.com/link_B'。如何为选定的 link 执行此操作? 是吗?
<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>
您需要将 "link_A" 部分移至 URL,因为 HTTP_HOST 仅匹配域名。所以你的规则应该是这样的
<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>