Configuring Azure WebSite to always resolve to Custom Domain
<p>I have a Wordpress Blog hosted on an Azure Website. The blog itself works great, and the Custom domain resolves correctly to the Azure WebSite URL. However, I'm hoping to configure the site such that the user's browser will always display the custom domain, even when they click a link within the site, rather than what happens now, which is as soon as you click any link within the site, the URL changes to the <a href="http://MyBlog.AzureWebSites.Net/" rel="nofollow noreferrer">http://MyBlog.AzureWebSites.Net/</a>{Content Url} URL. I see the related question <a href="https://stackoverflow.com/questions/12658634/custom-domain-name-on-azure-site-working-but-always-redirects-to-azurewebsites">Custom Domain Name on Azure site working, but always redirects to azurewebsites.net?</a>, but disabling Domain Forwarding in GoDaddy doesn't solve this URL issue. </p>

<p>The goal is to have the entire site working under www.MyBlog.com/ in the user's browser rather than <a href="http://MyBlog.AzureWebSites.Net/" rel="nofollow noreferrer">http://MyBlog.AzureWebSites.Net/</a>{rest of the url} as soon as they click any link . As per the documentation <a href="https://azure.microsoft.com/en-us/documentation/articles/web-sites-custom-domain-name/" rel="nofollow noreferrer">Configure a custom domain name in Azure App Service</a>, I have configured the CNAME and averify records which point to the Azure Web Site's IP address with GoDaddy, as well as adding the "Custom Domain" via the Azure Portal. The URL www.MyBlog.com does resolve correctly to <a href="http://MyBlog.AzureWebSites.Net" rel="nofollow noreferrer">http://MyBlog.AzureWebSites.Net</a>, and it stays as www.MyBlog.com until the user hits any link inside the site (say, opening a post), at which point, the URL becomes <a href="http://MyBlog.AzureWebSites.Net/2015-12-01/MyFirstPost" rel="nofollow noreferrer">http://MyBlog.AzureWebSites.Net/2015-12-01/MyFirstPost</a></p>

<p>I see some articles on how to achieve this with changes to the web.config file, such as <a href="http://onthecloud.azurewebsites.net/seo-tip-how-to-block-the-.azurewebsites.net-domain" rel="nofollow noreferrer">SEO Tip: How to block the *.azurewebsites.net domain</a>, which suggests adding this to the Web.Config:</p>

<pre><code>    &lt;rule name="Disable Azure Domain" patternSyntax="Wildcard" stopProcessing="true"&gt;
      &lt;match url="*" /&gt;
      &lt;conditions logicalGrouping="MatchAll" trackAllCaptures="false"&gt;
        &lt;add input="{HTTP_HOST}" pattern="*.azurewebsites.net" /&gt;
      &lt;/conditions&gt;
      &lt;action type="Redirect" url="http://www.example.com{REQUEST_URI}" redirectType="Permanent" /&gt;
    &lt;/rule&gt;
</code></pre>

<p>but whenever I try to make this change, both URLs stops resolving. They appear to go into an infinite loop redirecting to each other. </p>

<p>I'm not trying to redirect from one URL to another. Essentially, I want the webserver to always replace the <a href="http://MyBlog.AzureWebSites.Net/" rel="nofollow noreferrer">http://MyBlog.AzureWebSites.Net/</a> part of the URL with www.MyBlog.com/ . It's worth noting that when I manually enter www.MyBlog.com/2015-12-01/MyFirstPost, it serves the page correctly. </p>