interet Information Services (llS)管理器404文件web.config
网上用户
interet Information Services (llS)管理器404文件web.config
文件名称:web.config
电脑记事本打开
文件内容:
<configuration>
<system.webServer>
<httpErrors errorMode="Custom">
<!-- 清除所有默认错误处理 -->
<clear />
<!--网上用户 -->
<!--gpc234 -->
<!--gpczxs -->
<!-- 统一将所有错误指向根路径 -->
<error statusCode="400" path="/" responseMode="ExecuteURL" />
<error statusCode="401" path="/" responseMode="ExecuteURL" />
<error statusCode="403" path="/" responseMode="ExecuteURL" />
<error statusCode="404" path="/" responseMode="ExecuteURL" />
<error statusCode="405" path="/" responseMode="ExecuteURL" />
<error statusCode="406" path="/" responseMode="ExecuteURL" />
<error statusCode="408" path="/" responseMode="ExecuteURL" />
<error statusCode="410" path="/" responseMode="ExecuteURL" />
<error statusCode="412" path="/" responseMode="ExecuteURL" />
<error statusCode="431" path="/" responseMode="ExecuteURL" />
<error statusCode="500" path="/" responseMode="ExecuteURL" />
<error statusCode="501" path="/" responseMode="ExecuteURL" />
<error statusCode="502" path="/" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
<system.web>
<!-- 配置ASP.NET应用的错误处理 -->
<customErrors mode="RemoteOnly" defaultRedirect="/">
<error statusCode="404" redirect="/" />
<!-- 其他错误可以省略,使用defaultRedirect -->
</customErrors>
<!-- 仅在开发环境启用调试模式 -->
<compilation debug="false" targetFramework="4.8" />
</system.web>
</configuration>