Azure web site not respecting custom errors for 404

I created a new Azure web site using Umbraco and ASP.NET MVC.

When developing the site on my PC locally the site would redirect 404 errors to the sitemap page.

On deploying the site to Azure, incorrect URLs would display the following error (and not the sitemap as locally):

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

To fix add the following setting to web.config:

<configuration>
  ...
  <system.webServer>
    <httpErrors existingResponse="PassThrough" />
  ...
  </system.webServer>
  ...
</configuration>

Maintaing SEO after web site move from Webforms to MVC on Azure

My old site was web forms so had pages in the form “/widget/thing.aspx”.

I designed a new site using Umbraco and ASP.NET MVC with the new page being in the form “/widget-thing/”

The old pages had built up a reputation in google search results so I wanted to maintain the ranking.

To accomplish this I added rewrite rules to the web.config of the new site:


<configuration>

...

   <system.webServer>

...

      <rewrite>

          <rules>

               <rule name="firstrule" stopProcessing="true">

                      <match url="^widget/thing.aspx" />

                      <action type="Redirect" redirectType="Permanent" url="/widget-thing/"/>

                </rule>

                <!-- more rules here .... -->

          </rules>

     </rewrite>

...

  </system.webServer>

...

</configuration>