Tag Archives: redirect

Redirect 404 to homepage in ASP.NET

In <system.webServer> in the Web.config file add :

<httpErrors errorMode="Custom" existingResponse="Replace">
    <remove statusCode="404"/>
    <remove statusCode="500"/>
    <error statusCode="404" responseMode="Redirect" path="/" />
    <error statusCode="500" responseMode="Redirect" path="/" />
</httpErrors>
Advertisements