Azure重定向到自定义404页面
我正在尝试在Azure中配置一个web应用程序,以便在http状态代码为404时重定向到html页面。这是Azure中的静态html站点。我添加了包含以下内容的web.config和ApplicationHost.xdt文件,但它没有做任何事情:Azure重定向到自定义404页面,azure,iis,web-config,http-status-code-404,azure-web-app-service,Azure,Iis,Web Config,Http Status Code 404,Azure Web App Service,我正在尝试在Azure中配置一个web应用程序,以便在http状态代码为404时重定向到html页面。这是Azure中的静态html站点。我添加了包含以下内容的web.config和ApplicationHost.xdt文件,但它没有做任何事情: <system.webServer> <httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" > <
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" >
<remove statusCode="404"/>
<error statusCode="404" responseMode="ExecuteURL" path="http://www.website.com/404/index.html" />
</httpErrors>
在做了这些更改后,我重新启动了web应用程序,但它什么也没做。根据您的webconfig文件,如果将路径更改为“/404/index.html”,它将正常工作。请试一试
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" >
<remove statusCode="404"/>
<error statusCode="404" responseMode="ExecuteURL" path="/404/index.html" />
</httpErrors>
</system.webServer>
基于您的webconfig文件,如果将路径更改为“/404/index.html”,它将正常工作。请试一试
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" >
<remove statusCode="404"/>
<error statusCode="404" responseMode="ExecuteURL" path="/404/index.html" />
</httpErrors>
</system.webServer>