How to setup a 404 error page on your Umbraco site
So exactly how do I setup a 404 error page on my site?
It's good practice to use 404 error pages on your site instead of relying upon the built in IIS error handling mechanism and it's not that obvious how to set it up.
Simply follow these steps:
Create a new template on your site and link to for instance a standard text page document type
Create the new 404 page in the content area, be sure to use the correct template - publish it and make a note of the Node ID
Goto umbracoSettings.Config and find the <errors> section.
For the <error404> node, replace the number 1 with the id of your new 404 page. Save this file.
<!-- the id of the page that should be shown if the page is not found -->
<!-- <errorPage culture="default">1</errorPage>-->
<!-- <errorPage culture="en-US">200</errorPage>-->
That sorts out Umbraco but you will notice that any duff url's you add will still not show your shiny new page. This is because IIS is still handling these errors so we need to tell it to bog off and let Umbraco handle it instead.
Open up web.config and goto the <system.webServer> section
After that, add the following lines <httpErrors existingResponse="PassThrough" />
Save the file.
Now if you goto a duff url, IIS should pass your user through to your shiny new page.
You can also support multi-lingual sites, see the <errors> node for further information on how to do this.
Need an Umbraco Master?
Here at Simon Antony, we have an in house certified Umbraco Grand Master available for hire. Got a problem with your site, need architecture advice, give us a call to speak to Simon directly and see how we can helpContact Simon Today!