gpt4 book ai didi

html - Azure 自定义 404 页面

转载 作者:太空狗 更新时间:2023-10-29 15:29:43 26 4
gpt4 key购买 nike

我使用 Microsoft Azure 创建了一个 Web 应用程序,并将静态 html 页面上传到该 Web 应用程序。

它工作正常,但是,我想设置一个自定义 404 页面。在哪里或如何使用 Azure 门户执行此操作?

需要明确的是,这不是一个 Visual Studio 项目,它只是一些静态 html 文件。我只是想告诉 azure 使用我的 404 页面,而不是找不到页面时显示的默认文本。

编辑

请注意,这与 IIS 无关。我什至没有 web.config 文件。我只是在 Azure 中托管一些静态 html 文件,并且想要一个自定义 404 页面。我已经制作了404.html页面。

最佳答案

似乎您必须在根目录中添加一个 web.config 文件。这似乎是一种解决方法,但这样做并添加以下代码是可行的:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/404.asp" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>

关于html - Azure 自定义 404 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38335897/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com