Redirect your URL to your custom domain URL

If you’ve attached a custom domain to your Azure Websites setup, you probably want people and search engine crawlers to use the custom domain URL instead of the free URL. You can setup your application’s web.config to include the following.

Add the following to the system.webServer section of your web.config, but make sure you replace the “yourdomain” text with your own domain information.

5 thoughts on “Redirect your URL to your custom domain URL

    1. Hi Alam. That error makes me think that your domain’s SSL certificate isn’t setup properly. Can you give me some more info?

  1. Thanks for the info. I’m still new to this so this might be an obvious question but what is the second rule “WWW Rewrite” for?

    1. Hi Jonathan. The WWW Rewrite will force a non-www URL to redirect to the www equivalent. For example, if someone went to “” it would redirect to “”. But the rule has two “negates” which will not fire for an already www URL and a localhost URL (for dev purposes).

Leave a Reply

Your email address will not be published. Required fields are marked *