【问题标题】:Redirect to sub domain without changing URL- IIS重定向到子域而不更改 URL-IIS
【发布时间】:2017-11-07 01:57:17
【问题描述】:

我们有一个网站 www.A.Com,当我浏览 URL www.A.Com/loc
我需要重定向到由 SEO 提供商托管的子域 www.loc.A.Com 并显示由他们托管的页面。

主要要求是我们不应更改 URL,即 URL 应保持 www.A.Com/loc

我们通过定义以下规则尝试使用 URL 写入模块

<rewrite>
  <rules>
    <rule name="ProxyExample" stopProcessing="true">
      <match url="^locations/?(.*)" />
      <action type="Rewrite" url="http://A.Locations.com/{R:1}" />
      <serverVariables>
        <set name="HTTP_ACCEPT_ENCODING" value="" />
      </serverVariables>
    </rule>
  </rules>
</rewrite>

请注意,我们的网站托管在 Azure 应用服务上

【问题讨论】:

    标签: redirect iis url-rewriting web-config url-redirection


    【解决方案1】:

    如果您删除 serverVariables,您的规则应该有效:

    <rule name="ProxyExample" stopProcessing="true">
      <match url="^locations/?(.*)" />
      <action type="Rewrite" url="http://A.Locations.com/{R:1}" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-17
      • 2014-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多