I almost did serious correspondence and redesign / restructuring of an existing website that receives a lot of traffic. I use the IIS 7 URL rewrite module to use URLs without extension and SEO, and also redirect requests to old pages to corresponding pages in the new site structure. Everything is going well, but I'm learning how to set up a 404 user page, and I lost consciousness. So far, I have installed the following code in the node of the web.config file:
<httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/404.htm" responseMode="ExecuteURL" /> </httpErrors>
The fact is that it WORKS, but not quite! If I go to a nonexistent URL, I get my 404 page, but the request gets a 200 OK response code instead of 404. I looked for various httpErrors node attributes, but no luck. Does anyone know how to show a custom 404 page And return the actual 404 status code?
Thanks!
source share