404 Handler Emitting Wrong Status Code

Vote:
 

Hello. My new site has the issue discussed here:

https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2018/11/404-behaviour-inconsistent/

That thread doesn't seem to contain the info I need.

Specifically, a request for a missing page results in the user seeing a nice message, but no 404 status code is sent. Instead, it's sending 200. I need to fix this, per Google's guidelines seen here.

https://developers.google.com/search/docs/advanced/crawling/custom-404-pages

How do I set up the handler to emit the correct status code of 404?

Thanks.

#250918
Mar 18, 2021 14:05
Vote:
 

What version of Episerver CMS?
Are you using a 3rd party 404 handler?

#250919
Mar 18, 2021 14:11
Vote:
 

DXP, with BVN 404 Geta404

thnx

#250920
Edited, Mar 18, 2021 14:16
Vote:
 

This is the default behavior of this Epi module. You can implement the customizations mentioned on the git hub page to add controller and use the attribute (on your action that will return your custome view)

[NotFoundPage]

This will set status code for you to 404.

#250921
Mar 18, 2021 14:38
Kent Rauch - Mar 18, 2021 16:10
Thanks!
Praful Jangid - Mar 26, 2021 7:44
Hi Kent, if you got the solution can you please mark as answer or if you had a different solution please paste here and then you can that mark as answer.
Vote:
 

Thank you, Praful. That works. 

#251665
Mar 26, 2021 12:05
* 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.