【问题标题】:IIS URL Rewrite for Domains That Share Website共享网站的域的 IIS URL 重写
【发布时间】:2019-03-06 01:53:23
【问题描述】:

我有两个域都指向同一个 IIS 网站

domain1.com/website1

domain2.com/website1

我想写一个 URL Rewrite 规则来指向

domain1.com/* 

到特定的子域

domain2.com/subfolder.

我无法确定完成此操作的 IIS URL 重写规则。以下是我所拥有的:

<rule name="redirect" enabled="true" >stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain1\.com*$" />
</conditions>
<action type="Redirect" url="https://domain2.com/subfolder" />
</rule>

【问题讨论】:

    标签: asp.net iis url-rewriting


    【解决方案1】:

    试试这个语法:

    <rule name="redirect" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^domain1\.com*$" />
    </conditions>
    <action type="Redirect" url="https://domain2.com/subfolder" />
    </rule>
    

    我认为您的代码中有错字,在 stopProcessing 之前有一个“>”,不应该存在。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-03
      • 2017-09-08
      • 1970-01-01
      • 2018-06-25
      • 2016-12-28
      相关资源
      最近更新 更多