我有myazurecustomdomain.com指向我的应用程序服务,我有mygoogledomain.ca有一个资源记录指向我的应用程序服务。我已经在Azure中将这两个域分配给了我的应用程序。 现在,我希望将myazurecustomdomain.com重定向到mygoogledomain.ca,因为我有一些第三方库已订阅我的.ca域,并且我现在不一定要维护我的.com域。最好的方法是什么?
答案 0 :(得分:0)
如果您现在不想维护.com
域,则可以删除自定义域mapped to your app service。因此,您将可以通过当前的自定义域mygoogledomain.ca
或默认应用服务域(例如xxx.azurewebsites.net
)访问该Web应用。
当您有两个自定义域mapped到Azure应用服务时,您想将一个域重定向到另一个域。您可以在应用程序的web.config文件中添加重写规则。有关更多信息,您可以参考this answer。
<rewrite>
<rules>
<rule name="Redirect all to different domain" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^myazurecustomdomain.com$" />
</conditions>
<action type="Redirect" url="http://mygoogledomain.ca/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>