I have my website in .htm extension and the server is IIS 7. I have now design custom 404 page.
Now can anyone suggest me, how to implement custom 404 page by web.config.
Use this in your web.config
file:
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/Errors/NotFound" />
</httpErrors>
I too was having the same problem with .htm
pages in IIS7 (not ASP, not .NET).
I changed responseMode
to File
instead of ExecuteURL
in <system.webServer>
and everything worked:
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" responseMode="File" path="error.htm" />
</httpErrors>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With