Copied to clipboard

Flag this post as spam?

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


  • Graham Carr 277 posts 389 karma points
    Aug 24, 2015 @ 10:11
    Graham Carr
    0

    Custom 404 Page

    Hello,

    I have setup custom error pages following the details in the link below:

    https://our.umbraco.org/wiki/install-and-setup/configuring-404-pages

    This all works fine when it is a page being requested that does not exist. This does not work however if the user is trying to access a PDF or some other file that does not exist.

    How do you go about handling such cases and redirecting to an appropriate error page?

    Thanks.

  • Gary Devenay 39 posts 245 karma points
    Aug 24, 2015 @ 10:41
    Gary Devenay
    1

    Hi Graham,

    You should be able to add a setting in your Web.Config file that will be the response for all HTTP requests that return a status code of 404. It would look something like the following:

    <httpErrors>
        <error statusCode="404" path="/errors/404/" responseMode="ExecuteURL" />  
    </httpErrors>
    

    You should be able to use an Umbraco page url as the path too if you wish to use the same page.

    Gary

  • blackhawk 313 posts 1368 karma points
    May 30, 2017 @ 18:58
    blackhawk
    1

    The following actually solved my situation...

    <httpErrors existingResponse="Replace" errorMode="Custom">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="..." responseMode="ExecuteURL" />
        </httpErrors>
    

    ...simply adding existingResponse="Replace" errorMode="Custom" as attributes to the httpErrors element.

    All credit provided by the following post: https://stackoverflow.com/a/6661699/957186

  • MuirisOG 382 posts 1284 karma points
    Jun 09, 2017 @ 14:55
    MuirisOG
    1

    This is my second time posting this in the last few minutes :-D

    Try the steps in Morten Sørensen's blog below. These steps worked for me.

    https://blog.mortenbock.dk/2017/02/03/error-page-setup-in-umbraco/

    (PS Thanks Morten)

  • Norbert Haberl 32 posts 115 karma points
    Oct 09, 2017 @ 15:15
    Norbert Haberl
    2

    What about this ? Custom 404 in Umbraco 7

Please Sign in or register to post replies

Write your reply to:

Draft