Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • bikeman 21 posts 104 karma points
    Jan 29, 2021 @ 13:37
    bikeman
    0

    Custom 404

    I've followed the instruction in https://our.umbraco.com/documentation/tutorials/Custom-Error-Pages/ to update the umbracoSettings.config file with my error page.

    It works with a page ID or GUID but not with a page URL.

    How do I redirect to /error404/

    Thanks

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jan 29, 2021 @ 13:44
    Huw Reddick
    0

    create your content page called error404 and then use it's id in the umbraco config, that is basically it, or at least that is all I have done and it works fine.

  • bikeman 21 posts 104 karma points
    Jan 29, 2021 @ 14:52
    bikeman
    0

    As per my OP I want to use a page URL not a page ID.

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jan 29, 2021 @ 14:57
    Huw Reddick
    0

    it requires either an id, a guid or an xpath,

    Why do you need to use a url when it already has a perfectly good working way of doing it

  • bikeman 21 posts 104 karma points
    Jan 29, 2021 @ 15:02
    bikeman
    0

    Because it's a multi site and each site has a custom /error404/

    I wanted to use an xpath but the example doesn't work or any variation I tried.

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jan 29, 2021 @ 15:24
    Huw Reddick
    0

    could you show us the xpath you are using then, I would imagine that is where the issue is.

  • bikeman 21 posts 104 karma points
    Jan 29, 2021 @ 15:35
    bikeman
    0

    I don't understand the example given:

    • An XPath statement (example: //errorPages[@nodeName='My cool error']

    I tried my url and I tried substituting my page url in the @nodeName='/error404/'

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jan 29, 2021 @ 15:56
    Huw Reddick
    0

    It should work using xpath, this is what I have just tested in place of my ID

    <error404>//customErrors[@nodeName='Error404']</error404>
    

    customErrors is the document type and Error404 is my 404 document

  • bikeman 21 posts 104 karma points
    Jan 29, 2021 @ 16:04
    bikeman
    0

    Unfortunately that doesn't display the relevant site's 404 page.

    The 404 page from site 1 is always displayed.

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Jan 29, 2021 @ 16:12
    Huw Reddick
    1

    since I don't know how your site works it is a bit difficult to give you an exact answer, you will need to add some other parameter to the xpath to get the exact one or If it is culture based you could add a 404 setting for each culture as shown in the settings config file

  • bikeman 21 posts 104 karma points
    Feb 01, 2021 @ 16:08
    bikeman
    0

    ok thanks. I'll try to find out.

  • Thomas 319 posts 606 karma points c-trib
    Aug 24, 2021 @ 07:20
    Thomas
    0

    Did you find a solution ?? Have the same issue

  • Jeroen Oostwouder 104 posts 300 karma points
    Mar 20, 2024 @ 11:09
    Jeroen Oostwouder
    0

    Let me add that I have the same issue, 3 years later.

    No solution I guess? Implementing your own custom error handler?

  • Kevin Meilander 82 posts 408 karma points c-trib
    Sep 03, 2021 @ 02:28
    Kevin Meilander
    0

    As of 8.16, you should be able to use the $site in the error xpath path to specify the requested site. Eg $site//errorPage

    https://github.com/umbraco/Umbraco-CMS/issues/10354

    Before 8.16, you either need to manage it yourself if you have multiple sites. Probably by using a custom content finder.

    https://our.umbraco.com/documentation/Reference/routing/request-pipeline/IContentFinder

  • Joshua Crittenden 14 posts 124 karma points
    Oct 21, 2022 @ 21:20
    Joshua Crittenden
    0

    Here is how I was able to acheive a multi-site 404 page within the content tree:

                "Error404Collection": [
                    {
                        "Culture": "default",
                        "ContentXPath": "$site//contentFolder[@nodeName='Special Pages']//page[@nodeName='Page Not Found']"
                    }
                ]
    

    $site gets the relative root, then my path is /Special-Pages/Page-Not-Found, where Special-Pages is a "contentFolder" document type, and Page-Not-Found it a "page" document type.

  • Jonathon Cove 26 posts 101 karma points
    Jan 31, 2023 @ 10:23
    Jonathon Cove
    0

    I'd like to add, for those that don't know, this is within 'Umbraco > Cms > Content'

  • Kevin Meilander 82 posts 408 karma points c-trib
    Jan 31, 2023 @ 13:56
    Kevin Meilander
    0

    This is configured in the configuration values set in the code.

    Which code file its set in depends on the version.

    It's either in the UmbracoSettings.config for version 7 and 8. For more details see the error page guide,

    Or in the appsettings.json on version 9 and above.

Please Sign in or register to post replies

Write your reply to:

Draft