Learn from 350 other Umbracians at the annual Umbraco Conference - CodeGarden '13.
More than twenty high quality sessions, open spaces, hackathons and social events you'll remember. Not to be missed! Less than 45 tickets left - get yours now!
Will this work when using the single-domain name technique for multilingual sites at our.umbraco.org/.../running-multi-lingual-sites-under-a-single-domain?
I suspect not, since if it relies on ServerVariables["SERVER_NAME"] then that will always be the same regardless of target site.
Pretty much every technique I've tried so far won't deal with this; ie have /en/deadUrl show /en/error404, and /de/deadUrl show /de/error404, for example.
When you say using a single-domain, is the domain associated with the root content node? (under the "Manage Hostnames" menu).
If not, then the "MultiSitePageNotFoundHandler" wont work. The one you're after is called "SearchForPageNotFound" - it uses the same property alias "umbracoPageNotFound" - so you should only need to change the reference in your "404handlers.config".
There are hostnames associated with each of the three homepage/root nodes, but those hostnames are not 'real', only used to get locale switching and provide the first part of URLs;
en.domain.com > /en/fr.domain.com > /fr/de.domain.com > /de/
I'll try SearchForPageNotFound and report back...
Still not working I'm afraid; all incorrect urls are showing the English page, irrespective of the first url segment. For example, /de/foobar?umbDebugShowTrace=true shows the English page, with debug output;
notFoundHandlerTrying NotFoundHandler 'uComponents.Core.NotFoundHandlers.SearchForPageNotFound'... Resolve Urls0notFoundHandlerNotFoundHandler 'uComponents.Core.NotFoundHandlers.SearchForPageNotFound found node matching de/foo with id: 1139
(Node 1139 is the English 404 page)
I have configured multisite stuff as follows;
And have setup an umbracoPageNotFound Content Picker as follows, and published each of the three 'root' nodes with a selected page;
Looking at the source for SearchForPageNotFound, I don't think it will do what's needed anyway; it'll find all nodes with an umbracoPageNotFound property, and simply returns the first (ie the English one in my example above).
SearchFor404ContentHandler seems closer, but that looks for the 'closest' page (in url) of type ErrorPage?
FYI, SearchFor404ContentHandler does the job; all I had to do was change the alias of my 404 error page to be ErrorPage, and things work as expected.
http://www.ridethewaveright.com is the site, if anyone wants to verify this works as I hope ;-)
Glad that the SearchFor404ContentHandler worked for you ... IMO it would work better if it found nodes with a specific property alias (same as the other ones), instead of searching for the doc-type alias. But it appears to be working well for you (I tested your link too). (Disclaimer: I didn't write the 'SearchFor404ContentHandler' code).
Going forwards, if there are any improvements that you think the other NotFoundHandlers should have, feel free to raise an issue on our CodePlex.