The following forum(s) have migrated to Microsoft Q&A (Preview): Azure App Service - Web Apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

Azure naked domain redirection to www RRS feed

  • Question

  • Hi All

    I'm using Azure App Service and Azure DNS
    Does anyone knows how to redirect naked domain to www ?


    Saturday, July 16, 2016 9:07 PM


All replies

    • Marked as answer by RAF-P Saturday, March 11, 2017 6:18 PM
    Sunday, July 17, 2016 12:31 PM
  • In Your web.config You must add the rewrite rule:

            <rule name="Redirect to www" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                    <add input="{HTTP_HOST}" pattern="" />
                <action type="Redirect" url="{R:0}" />

    Sunday, July 17, 2016 11:51 PM
  • Thanks for the reply. This doesn't work because there is not a static IP address available through the Azure CDN.
    Thursday, August 30, 2018 3:15 PM
  • Thanks! I'm using the GUI Rules Engine, and the closest I'm getting is this:

    <rules xmlns="" schema-version="2">
      <rule id="XXXXX" platform="http-large" status="active" version="0" custid="XXXX">
        <description>Redirect to www</description>
        <match.referring-domain result="match" value="" ignore-case="true">
          <feature.url-redirect code="301" pattern="/XXXXXX/my-domaincdn/*" value="{R:0}" />

    Not sure what the equivalent to {HTTP_HOST} is, I thought "Referring Domain" would be, but still not working. Any thoughts?

    Thursday, August 30, 2018 3:20 PM
  • @darrenhe, Sorry for the delay. The initial question was more specific to Azure App Service WebApps, but you are leveraging Azure CDN service; for this, you may take a look at this feedback post and upvote: Naked Domain CDN. Also, checkout the suggestions outlined in this discussion thread: Mapping a CDN to my naked domain.


    For more specialized assistance on Azure CDN related questions you may post your questions on Azure CDN forums for receiving inputs from the targeted audience.

    Thursday, September 20, 2018 8:39 AM