2017-03-07 122 views
0

我想在Azure中配置一个Web应用程序以重定向到一个html页面,如果http状态码是404。这是一个静态的在Azure中的html网站。我已经加入的web.config和ApplicationHost.xdt文件与这些内容并没有做任何事情:Azure重定向到自定义404页面

<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应用程序,它没有做任何东西。

回答

3

基于您的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>