【问题标题】:redirect subdomain pages to a primary domain page将子域页面重定向到主域页面
【发布时间】:2021-08-08 18:00:34
【问题描述】:

我有一个客户需要像这样重定向 URL:

https://events.example.com/page/

到主域上的特定页面:

https://www.example.com/events

我没有任何运气这样做。 DNS 已更改,因此主要 events.example.com 当前指向主页,我正在尝试使用 Azure web.config 中的 IIS 重写规则来完成此操作。不确定是否重要,但该站点托管在 Sitecore 8.2.7 上。这是我必须遵守的规则:

<rule name="Events Sub-domain Redirect">
          <match url="(.*)" />
          <conditions>
              <add input="{HTTP_HOST}" pattern="events.example.com^" />
          </conditions>
          <action type="Redirect" url="www.example.com/page-target" redirectType="Permanent" />
      </rule>

我已经尝试了几种变体,但没有任何运气。提前感谢您的帮助!

【问题讨论】:

    标签: redirect iis-10


    【解决方案1】:

    如果你想从https://events.example.com/page重定向到https://www.example.com/events,可以参考这个例子:

    <rule name="test" enabled="true" stopProcessing="true">
       <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^events.example.com$" />
            <add input="{HTTPS}" pattern="on" />
            <add input="{REQUEST_URI}" pattern="^/page" />
          </conditions>
       <action type="Redirect" url="https://www.example.com/events" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-02
      • 2018-04-09
      相关资源
      最近更新 更多