将子域重定向到 Azure 上的目录
Redirecting subdomain to directory on Azure
简而言之,如何将 test.example.com
重定向到 example.com
?我想让子域对用户来说看起来是 "real"(在后台重定向,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 | URL: example.azurewebsites.net |记录类型:CNAME(别名)
执行此操作时,我收到以下错误消息:
The page cannot be displayed because an internal server error has occurred.
我已通过将以上内容更改为
来解决问题
<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}" />
简而言之,如何将 test.example.com
重定向到 example.com
?我想让子域对用户来说看起来是 "real"(在后台重定向,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 | URL: example.azurewebsites.net |记录类型:CNAME(别名)
执行此操作时,我收到以下错误消息:
The page cannot be displayed because an internal server error has occurred.
我已通过将以上内容更改为
来解决问题<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}" />