Written by Per Ploug Hansen     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

The standard Umbraco Not Found handlers

By default there are 4 standard handlers active in a freshly installed umbraco 3.0 let's have a look at them and explain what they do.

404handler

The 404handler is probably the best know and most used not found handler. It's also the simplest.

In the /config/umbracoSettings.config file you can find a value under the <error404> node. This is by default set to "1". But if you change it to an ID of a content node, Umbraco will display this page as the installations standard 404 page - everytime it can't find a specific page. Simpel isn't it?

Search for alias

This handler will search for a node with a  "umbracoUrlAlias" property containing the current url.
F.exemple: You have a node at "/news/archive.aspx" but you can see in your stats that people misspell archive, so you would like to have /news/archiv.aspx and /news/archiiiiv.aspx as backup url's.  

You would add a "umbracoUrlAlias" property (a textstring f.ex) to the document type and set it's value to "/news/archiv.aspx,/news/archiiiv.aspx" Now the original archieve page will be displayed on those 2 urls aswel.

Search for template

Another standard handler is the search for template handler. This is actually a new feature in Umbraco 3, but the code behind it is actually all V2 features, really shows how Umbraco has a neat extendable core btw.

In V2 you could add the querystring ?altTemplate={templateAlias} to the url and it would use that as a template instead. but you would end up with some ugly urls.

The search Template handler makes this look alot better. So for exemple:
You have /news.aspx and a rss template which will take the news.aspx page and serve it as a rss 2.0 xml document instead. this would normally look like this: /news.aspx?altTemplate=rss

Now with this handler you can add the template alias directly in the url.

So instead it would look like /news/rss.aspx and the handler would add the querystring to the httprequest behind the scenes,
so umbraco would still use ?altTemplate=rss to change the template to "rss".

- much nicer isn't it?

Search for profile

The last standard handler is "Search for profile" which is usually used with umbraco members profile pages.

In your web.config there's a umbracoProfileIrl under appsettings. by default it says "profiler" this means that the node at the url /profiler.aspx is your profile page, and to use it you can pass a members alias to it like this:
/profile/perploug.aspx - then the Profile search will set a umbMemberLogin value to "perploug" and returns the profiler.aspx page, where you can then have all sorts of xslt macros taking advantage of the umbMemberLogin value to display all sorts of information about the member..

like the umbraco forum does like this:
http://forum.umbraco.org/profiles/drobar