Why is it that 404 behaviour is inconsistent:
These bad urls produce different outcomes:
These urls go to our custom 404https://www.gknpm.com/en/our-businesses/gkn-sinter-metalss/https://www.gknpm.com/en/our-businesses/gkn-sinter-metalss
This URL goes to a server 404https://www.gknpm.com/en/our-businesses/gkn-sinter-metals/s
Can anyone tell me what is going on here?
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.
The version is 184.108.40.206, 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></customErrors>
<httpErrors errorMode="Detailed"><remove statusCode="404" /><error statusCode="404" path="/en/utilities/404-page-not-found/" responseMode="ExecuteURL" /></httpErrors>
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/" /></customErrors>
<httpErrors errorMode="Custom" existingResponse="Auto"><remove statusCode="404"/><error statusCode="404" path="/en/Utilities/404-page-not-found/" responseMode="ExecuteURL"/></httpErrors>
Thanks for your helpMarshall
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).