Written by     For umbraco versions: All

Reference
Not found handlers are used to present alternative content when a url doesn't return a page. This will go through the standard handlers and show how to create and setup your own.

Contents

Setting up a custom Not Found handler in umbraco

I usually setup my custom handlers just above the handle404 standard handler, so if my handler fails I still have the standard 404 as a backup. And I will still have the alias and template search before my custom 404 handler. So below is the standard contents of /config/404handlers.config with my handler added as the second last one.

<?xml version="1.0" encoding="utf-8" ?> 
<NotFoundHandlers>
<notFound assembly="umbraco" type="SearchForAlias" />
<notFound assembly="umbraco" type="SearchForTemplate"/>
<notFound assembly="umbraco" type="SearchForProfile"/>
       <notFound assembly="MyCustomHandler" type="NotFoundHandler"/>
<notFound assembly="umbraco" type="handle404"/>
</NotFoundHandlers>

And thats it, now you can create your own handlers to help you direct your users to the right content or, atleast a suitable alternative.