Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure重定向到自定义404页面_Azure_Iis_Web Config_Http Status Code 404_Azure Web App Service - Fatal编程技术网

Azure重定向到自定义404页面

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" > <

我正在尝试在Azure中配置一个web应用程序,以便在http状态代码为404时重定向到html页面。这是Azure中的静态html站点。我添加了包含以下内容的web.config和ApplicationHost.xdt文件,但它没有做任何事情:

<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>