【问题标题】:Redirecting subdomain to directory on Azure将子域重定向到 Azure 上的目录
【发布时间】:2015-06-09 02:37:45
【问题描述】:

简单地说,我如何将test.example.com 重定向到example.com?我想让子域对用户来说看起来“真实”(在后台重定向,URL 仍然是test.example.com/index.html)。我已尝试修改域上的 DNS 设置、IIS 配置,并将我的子域添加到我的 Azure 配置中。

Web.Config

<rule name="Push Subdomain to Push folder">
<match url="(.*)" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^test.example.com$" />
    </conditions>
<action type="Rewrite" url="http://example.com/test/{R:1}" />

我的 DNS 配置:

子域:test |网址:example.azurewebsites.net |记录类型:CNAME(别名)

当我这样做时,我收到以下错误消息: The page cannot be displayed because an internal server error has occurred.

【问题讨论】:

    标签: azure iis dns azure-web-app-service


    【解决方案1】:

    我已通过将上述更改为

    解决了问题
    <rule name="Rewrite sub-domain to dir" enabled="true">
    <match url="^(.*)$" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^test\.example\.com$" />
    </conditions>
    <action type="Rewrite" url="test/{R:1}" />
    

    【讨论】:

    • 有点旧的帖子,但我需要问你。我想在我的 Azure 网站上做同样的事情。当我执行上述操作时,我收到一个内部服务器错误 (500)。你能帮帮我吗?谢谢。
    猜你喜欢
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 2013-08-28
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多