I have myazurecustomdomain.com which points to my App Service, and I have mygoogledomain.ca which has a ressource record to point on my app service. I have assigned those two domains to my app in azure. Now I want myazurecustomdomain.com to be redirect to mygoogledomain.ca because I have some third party libraries that are subscribe to my .ca domain and I don't necessarily want to maintain my .com domain for now. What is the best way to do this.
Asked
Active
Viewed 185 times
1 Answers
0
If you don't want to maintain the .com
the domain now, you could remove the custom domain mapped to your app service. So you will get access to that web app via the current custom domain mygoogledomain.ca
or default app service domain like xxx.azurewebsites.net
.
When you have two custom domains 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 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>

Nancy
- 26,865
- 3
- 18
- 34
-
Thanks Nancy, I will try adding this in web config. – Marc Bradley Nov 15 '19 at 13:06