Redirect azure domain to custom domain RRS feed

  • Question

  • User600175021 posted

    I'm hosting a website on Azure. You get a free domainname in this form mydomain.azurewebsites.net. I want to forward this domain to a custom domain, www.mydomain.com. I wrote this rule in web.config:

    <rule name="Redirect old-domain to new-domain" stopProcessing="true">
        <match url=".*" />
            <add input="{HTTP_HOST}" pattern="^mydomain.azurewebsites.net$" />
        <action type="Redirect" url="http://www.mydomain.com/{R:0}" appendQueryString="true" redirectType="Permanent" />

    This did the trick, but only for the homepage. When I go to mydomain.azurewebsites.net it will redirect tot www.mydomain.com. But when I go to mydomain.azurewebsites.net/page1/name1, there is no redirect. Is it possible to redirect alle pages to my custom domain, so mydomain.azurewebsites.net/page1/name1 has to redirect to www.mydomain.com/page1/name1.

    I connected my custom domainname already to azure, but the azure domain is already indexed in Googl eso I have to perform a redirect to my custom domain, for alle pages.

    Wednesday, March 30, 2016 8:01 PM


  • User-646145796 posted


    As my test, the rule seems correct. I create two site: mywebtestsite1.azurewebsites.net/ and mywebtestsite2.azurewebsites.net/, set the home/contact with the special sentences. When visit the site 1: mywebtestsite1.azurewebsites.net/home/contact, it redirect to site 2: mywebtestsite2.azurewebsites.net/home/contact.  So I would suggest you check whether your customer domain site could be accessed.

    Best Regards,


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 31, 2016 2:49 AM