简体   繁体   English

IIS 7将301域A重定向到域B

[英]IIS 7 redirect 301 domain A to domain B

How can I redirect(301) in IIS7? 如何在IIS7中重定向(301)? I'm trying redirect link form 'domainA.com/link_A' to 'domainB.com/link_B' using rewrite rules in web.config. 我正在尝试使用web.config中的重写规则将链接形式从“ domainA.com/link_A”重定向到“ domainB.com/link_B”。 How can I do this for selected links? 如何为选定的链接执行此操作? It is right? 这是正确的?

    <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>

You need to move the "link_A" part to the URL, since the HTTP_HOST only matches the domain name. 您需要将“ link_A”部分移至URL,因为HTTP_HOST仅与域名匹配。 So your rule should look something like this 所以你的规则应该看起来像这样

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM