Written by Irmak Tevfik on 29 - Jul - 2014

How To Create a URL Rewrite Rule for Azure Websites to use Single Custom Domain

Introduction
While hosting your website with two different domains and same content might cause slight issues on search engine rankings. 
In case of Azure, we have:


Two active domains both on www.4sln.com and websitename.azurewebsites.net ​will cause Search engines to consider the earliest active website on ranking.
Simplest approach will be to include URL rewrite on publish web.config profile​ as:
<system.webServer>
   <rewrite>
     <rules>
       <rule name="SEOAzureRewrite" stopProcessing="true">
         <match url=".*" />
         <conditions>
           <add input="{HTTP_HOST}" pattern="^oldwebsite.azurewebsites.net$" />
         </conditions>
         <action type="Redirect" url="http://www.new-web-site.com/{R:0}" redirectType="Permanent" />
       </rule>
     </rules>
   </rewrite>
</system.webServer>
this rule will redirect all of the hits from old URL to the new one.




comments powered by Disqus