I have just added some custom error pages to my Umbraco node tree. I have followed instructions found for assigning custom error pages, but I cant get them to work.
I have added the node to umbracoSettings.config for error404, but for some reason I'm still left with the default 404 page. I wonder if there are more settings that have to be added somewhere or if something has to be restarted for them to work?
I've never used that setting but have heard some mixed results about it. Instead I ususally just use IIS to use a custom page for 404 errors, by adding this to the web.config:
Seems to work fine for me. The only catch is to make sure your error page template doesn't have any 404's (missing images, etc) because it can cause a bit of a loop and slows things down.
I was writing my reply, when I just thought of looking through web.config (to investigate Tom Fultons suggestion), where I found the property
<system.web> <customErrors mode="Off" /> ...
Setting the mode to "On" solved the problem :) - I find it rather strange that not one of the forum posts I have read mentioned anything about that in web.config.
I don't think that the cusom errors value has anything to do with the error 404 pages. I think you saw a change because you touched the web.config, which recycles the application and makes changes done in umbracoConfig.config and in XSLT files etc. appear...like when you've made some changes in a stylesheet but they don't appear untill you clear the browser cache.
I would really still like to see how you wrote it in umbracoSettings.config becaue I suspect that two things might be the issue
1) You're trying to set multiple 404 pages for the same culture - if that is the case you'll need to install uComponents and use their 404 handler, which supports this
2) You're getting the syntax for setting multiple 404 pages with different cultures wrong (That's what I did yesterday).
The solution for multiple 404 pages with different cultures are to write it like this:
I must admit that I've never used IIS to handle this and I've never used plesk so I don't have any clues on what you need to tryout there. But perhaps the above can solve this for you 100%?
With that config, the errorpage shows up just fine when navigating a node that has no template assigned. When navigating to the url of an unpublished node or random text, the standard error page is displayed.
When running a single language website, wouldnt it suffice to add <errors><error404>node-ID</error404></errors>?
I assume that the errorpage shown, is related to the webserver and not Umbraco, since it does not say "This page is intentionally left ugly ;-)"
Yes when you're only dealing with one 404 page what you suggest is enough.
Hmm, it should not be possible to navigate to a unpublished node? If it's not published it does not have any URL If it has been published and the node has since been changed then it of course has a url but would also exist so it should be displayed.
if the node does not have a template assigned then it will not be visited unless you for some reason link to published nodes that does not have any template assigned, which would not make much sense?
I don't know how to deal with it though but I must admit I don't see it as a big issue since I can't imagine a scenario where you would point people to a node, with no template assigned.
Well, when no template is assigned and you follow a link to that particular node, the errorpage is displayed.
The issue is that I would like the 404 page to "catch" all requests to pages that does not exist. As of now, it only works in the case just mentioned, which is as you say, not a desired functionality.
Just to give you a bit more info on this, I've recently done some work formalising an error approach, and you'll probably find you get the same result with default config:
-http://yourdomain/notapage.aspx - this will go to your umbraco 404 page, as it is handled by Umbraco
-http://yourdomain/notapage.jpg, http://yourdomain/notapage.jpg - these aren't handled by .net (and therefore not by Umbraco), so you get the IIS 404
-http://yourdomain/umbraco/notapage.aspx - this isn't handled by Umbraco, as they're within a directory excluded from Umbraco's routing, but because of the .aspx extension, it is handled by .net, so you'll get your default .net 404.
That's three diferent 404s...
While it seems like a pain, I'd suggest it's good practice to get ALL of these to 404 to the same Umbraco page - I'd set this page up in your web.config and in IIS also
Custom error pages
Hi.
I have just added some custom error pages to my Umbraco node tree. I have followed instructions found for assigning custom error pages, but I cant get them to work.
I have added the node to umbracoSettings.config for error404, but for some reason I'm still left with the default 404 page. I wonder if there are more settings that have to be added somewhere or if something has to be restarted for them to work?
The website is running on Umbraco 4.7.1.
Best regards
Stefan
Hi Stefan
Can you show us how you have configured the pages in the config file? Might be a syntax thing that is teasing.
Also try to recycle the app pool.
/Jan
Hi Stefan,
I've never used that setting but have heard some mixed results about it. Instead I ususally just use IIS to use a custom page for 404 errors, by adding this to the web.config:
Seems to work fine for me. The only catch is to make sure your error page template doesn't have any 404's (missing images, etc) because it can cause a bit of a loop and slows things down.
-Tom
Thank you for your input on this.
I was writing my reply, when I just thought of looking through web.config (to investigate Tom Fultons suggestion), where I found the property
Setting the mode to "On" solved the problem :)
- I find it rather strange that not one of the forum posts I have read mentioned anything about that in web.config.
Thanks!
Hm, I might have submitted my post too fast...
When clicking a link to a node that has no template assigned to it, the 404 errorpage is shown.
If I enter a random url (eg. mydomain.com/what-ever) I expect the custom erorpage to be shown.
Instead I'm directed to the custom errorpages of IIS.
In Plesk controlpanel I can see that custom error pages are set to "On", and I dont know if that can interfere
with Umbraco somehow?
Hi Stefan
I don't think that the cusom errors value has anything to do with the error 404 pages. I think you saw a change because you touched the web.config, which recycles the application and makes changes done in umbracoConfig.config and in XSLT files etc. appear...like when you've made some changes in a stylesheet but they don't appear untill you clear the browser cache.
I would really still like to see how you wrote it in umbracoSettings.config becaue I suspect that two things might be the issue
1) You're trying to set multiple 404 pages for the same culture - if that is the case you'll need to install uComponents and use their 404 handler, which supports this
2) You're getting the syntax for setting multiple 404 pages with different cultures wrong (That's what I did yesterday).
The solution for multiple 404 pages with different cultures are to write it like this:
<errors>
<error404>
<errorPage culture="default">1773</errorPage>
<errorPage culture="en-US">1774</errorPage>
<errorPage culture="de-DE">1775</errorPage>
</error404>
</errors>
I must admit that I've never used IIS to handle this and I've never used plesk so I don't have any clues on what you need to tryout there. But perhaps the above can solve this for you 100%?
/Jan
Okay, I just realized that you're right regarding the customErrors mode. It also works after switching it off.
This is how it looks in umbracoSettings.config
With that config, the errorpage shows up just fine when navigating a node that has no template assigned.
When navigating to the url of an unpublished node or random text, the standard error page is displayed.
When running a single language website, wouldnt it suffice to add <errors><error404>node-ID</error404></errors>?
I assume that the errorpage shown, is related to the webserver and not Umbraco,
since it does not say "This page is intentionally left ugly ;-)"
Any clues?
Hi Stefan
Yes when you're only dealing with one 404 page what you suggest is enough.
Hmm, it should not be possible to navigate to a unpublished node? If it's not published it does not have any URL If it has been published and the node has since been changed then it of course has a url but would also exist so it should be displayed.
if the node does not have a template assigned then it will not be visited unless you for some reason link to published nodes that does not have any template assigned, which would not make much sense?
I don't know how to deal with it though but I must admit I don't see it as a big issue since I can't imagine a scenario where you would point people to a node, with no template assigned.
/Jan
Well, when no template is assigned and you follow a link to that particular node, the errorpage is displayed.
The issue is that I would like the 404 page to "catch" all requests to pages that does not exist.
As of now, it only works in the case just mentioned, which is as you say, not a desired functionality.
Just to give you a bit more info on this, I've recently done some work formalising an error approach, and you'll probably find you get the same result with default config:
-http://yourdomain/notapage.aspx - this will go to your umbraco 404 page, as it is handled by Umbraco
-http://yourdomain/notapage.jpg, http://yourdomain/notapage.jpg - these aren't handled by .net (and therefore not by Umbraco), so you get the IIS 404
-http://yourdomain/umbraco/notapage.aspx - this isn't handled by Umbraco, as they're within a directory excluded from Umbraco's routing, but because of the .aspx extension, it is handled by .net, so you'll get your default .net 404.
That's three diferent 404s...
While it seems like a pain, I'd suggest it's good practice to get ALL of these to 404 to the same Umbraco page - I'd set this page up in your web.config and in IIS also
is working on a reply...