I am working with Umbraco 7.5.2 and I am trying to set a custom 404 page. I am hosting 2 totally different sites on the same Umbraco.
I've created my page types and pages in the back office and in umbracoSettings.config I have added this:
<errors>
<error404>//errorListFolder/page[@nodeName = '404']</error404>
Which will find the page with name 404 from type page right below errorListFolder.
But this page is the same for both of my sites (shows the one on the first site). How can I fix it to show the relevant error page on each site?
I have tried
<error404>$site//errorListFolder/page [@nodeName='404']</error404>
But it doesn't find anything and I will end up with the basic error page of umbraco
And this is my structure (I removed the other nodes for simplicity)
Thanks to Marcin, I could fix it with Nibble.Umbraco.PageNotFoundManager. It is a wonderful tool! but I need to mention that you have to set umbracoSettings.config manually back to normal, otherwise it won't work.
I had the xpath in that file and no matter what I select in the back office, I couldn't see my page. then I change that back to 1 and it is working like a charm :)
You can access specific trees by going from $root element. Check my solution from one of our projects:
<error404>
<errorPage culture="pl-PL">$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
<errorPage culture="en-US">$root/homePage[@nodeName='EN']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
<errorPage culture="default">$root/homePage[@nodeName='PL']/hTMLContentPage[@nodeName='content not found TERROR - 808']</errorPage>
</error404>
It takes first node with original name 'content not found TERROR - 808' from node of type 'homePage' and specific nodeName as you can see above.
For your scenario, you should try Umbraco Page Not Found Manager made by Tim Geyssens: https://our.umbraco.org/projects/backoffice-extensions/umbraco-page-not-found-manager/ (uHangout: https://www.youtube.com/watch?v=bFL0xUhRerI). Probably it's something what you're looking for. It may be hard or even impossible to arrange it with basic error404 settings in config file, especially if you want to keep some culture depending 404's underneeth previously accesed tree nodes.
Hope that it help you!