404 behaviour inconsistent


Why is it that 404 behaviour is inconsistent:

These bad urls produce different outcomes:

These urls go to our custom 404


This URL goes to a server 404


Can anyone tell me what is going on here?


Nov 28, 2018 15:49

Hi, it would help if we know what CMS version you are using and also are you using any 3rd party 404 handler?

If the answer is no to the 3rd party 404 handler then can you paste here your 'customErrors' (under system.web) and 'httpErrors' (under system.webServer) configuration.

Also have you set the Episerver globalErrorHandling=off or do you have this setting at all (under episerver -> applicationSettings in web.config)?

Just guessing what happens is that asp.net errors (system.web) do a redirect (302) to your custom error page but exceptions happening in IIS (system.webServer) are not handled.

The current 404  implementation on the site is not SEO friendly as it does a 302 redirect to a custom 404 page that returns http status 200 (OK). Strcitly speaking if the content is not found, then you should not return 302 redirect following 200 OK but friendly error page with http status code 404.

Edited, Dec 01, 2018 11:55

Hi Antti,

The version is, no 3rd party 404 handler is being used and here are the config settings:

<customErrors mode="On" redirectMode="ResponseRedirect" defaultRedirect="/en/utilities/404-page-not-found/">
<error statusCode="404" redirect="/en/utilities/404-page-not-found/"></error>

<httpErrors errorMode="Detailed">
<remove statusCode="404" />
<error statusCode="404" path="/en/utilities/404-page-not-found/" responseMode="ExecuteURL" />

<applicationSettings globalErrorHandling="Off"

Thank you,

Nov 29, 2018 10:00

Hi Antti - i have changed the configuration slightly and it is delivering to the custom page in the use cases listed.

<customErrors mode="On" defaultRedirect="/en/Utilities/404-page-not-found/" redirectMode="ResponseRedirect">
<error statusCode="404" redirect="/en/Utilities/404-page-not-found/" />

<httpErrors errorMode="Custom" existingResponse="Auto">
<remove statusCode="404"/>
<error statusCode="404" path="/en/Utilities/404-page-not-found/" responseMode="ExecuteURL"/>

Thanks for your help

Edited, Nov 29, 2018 11:48

Just adding here that you previously had httpErrors errorMode="Detailed", so you were getting the IIS detailed error page because of that when the 404 was handled by IIS and not asp.net. And when the 404 was handled by asp.net you were getting the expected custom asp.net defined error page.

Your 404 implementation works for people but not for "machines". What I mean people will see "404 page not found", for average normal user the "404" in the text doesn't mean anything - they don't know HTTP status codes.

What comes to SEO and crawlers, your 404 implementation is wrong. When a crawler tries to crawle a page on that site and the page doesn't exist the crawler gets 302 redirect when the "404" is handled by asp.net and when the "404" is handled by IIS the crawler gets HTTP status 200 OK! If something is not found you should return HTTP status code 404 (not 302 redirect or even worse http status 200 OK).

For example:

  • /en/innovation/hydrogen-technology-not-found/ returns http status 302 (redirect to your nice not found page)
  • /en/innovation/hydrogen-technology/not-found/ returns http status 200 OK, but displays the nice not found page
Edited, Dec 01, 2018 12:09
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.