将 Azure 自定义域重定向到外部域(Google 域)

Redirect Azure custom domain to external domain (Google domain)

我有 myazurecustomdomain.com 指向我的应用服务,我有 mygoogledomain.ca 有资源记录指向我的应用服务。我已将这两个域分配给我的 Azure 应用程序。 现在我希望 myazurecustomdomain.com 重定向到 mygoogledomain.ca,因为我有一些第三方库订阅了我的 .ca 域,我现在不一定要维护我的 .com 域。执行此操作的最佳方法是什么。

如果您现在不想保留 .com 域,可以删除自定义域 mapped to your app service。因此,您将通过当前自定义域 mygoogledomain.ca 或默认应用服务域(如 xxx.azurewebsites.net.

访问该 Web 应用

当您有两个自定义域时mapped to your azure app service, you want to redirect one domain to another domain. You could add rewrites rules in the web.config file of your applications. For more information, you could refer to

<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>