Umbraco 301 tracker

Recently I’ve had to migrate an older site into Umbraco. There’s already a fantastic 301 tracker package which removes any worry from renaming pages and the resulting change in URL.

Unfortunately, the site’s I’m bringing in are Classic asp so pages have a .asp extension. So, we look at /config/UrlRewriting.config and Regular Exceptions.

<add name="ASP redirect"
virtualUrl="^~/(.*).asp(\?.*)*$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="/redirects/$1.aspx"
ignoreCase="true"
/>

This lets us take all those old asp files and bounce them to the /redirects/ folder as a .aspx file. From here, we can take advantage of the 301 tracker to capture that .aspx file and redirect it to the new page

Done 🙂

EDIT
http://stackoverflow.com/questions/11036508/umbraco-custom-404-error-page-not-working

On a related note, to get the custom 404 showing – “add the below code in system.webServer tag in web.config.

<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="400" path="/404" responseMode="ExecuteURL" />
<error statusCode="404" path="/404" responseMode="ExecuteURL" />
</httpErrors>