【问题标题】:Azure redirect to custom 404 pageAzure 重定向到自定义 404 页面
【发布时间】:2017-03-07 04:05:39
【问题描述】:

如果 http 状态代码为 404,我正在尝试将 Azure 中的 Web 应用程序配置为重定向到 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>

进行这些更改后,我重新启动了网络应用程序,但它没有做任何事情。

【问题讨论】:

    标签: azure iis web-config http-status-code-404 azure-web-app-service


    【解决方案1】:

    根据你的 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> 
    

    【讨论】:

      猜你喜欢
      • 2012-10-01
      • 2015-08-01
      • 2016-11-21
      • 1970-01-01
      • 2015-04-17
      • 2014-12-23
      • 2019-09-14
      • 2015-10-10
      • 1970-01-01
      相关资源
      最近更新 更多