[英]Custom 404 not found page in iis 7 for Classic ASP
我安装了Windows 2008服务器集成的iis 7.0
1天前,我使用的是Windows 2003和iis 6.0
使用Windows 2008服务器,一切都没问题,除了一件事。
在2003-iis6我可以使用自定义404页面处理网址友好网站。 例如,我可以将custom404.asp设置为自定义404页面(执行URL)
在2008年,我不能这样做。 当我将自定义404页面设置为/custom404.asp时,没有任何反应。 在自定义错误页面中,它表示这是针对asp.net的
我该怎么做?
在IIS管理器的“错误页面”部分中,选择“操作”部分下的“编辑功能设置...”。 确保选中“自定义错误页面”。
下面的webconfig文件修复了问题。 我分享以防任何人需要
将代码保存为web.config并将其移动到主站点文件夹
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="/default.asp" responseMode="ExecuteURL" />
</httpErrors>
<rewrite>
<rules>
<rule name="MyURLCleaned" enabled="false" stopProcessing="true">
<match url="^([^])+" />
<conditions>
<add input="{REQUEST_FILENAME}" />
</conditions>
<action type="Rewrite" url="/default.asp?{R:0}" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="static">
</rewriteMap>
</rewriteMaps>
</rewrite>
</system.webServer>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.