IIS下的PHP错误处理:当需要不存在的页面时,web.config仍然不会重定向

时间:2017-02-07 17:40:55

标签: php iis-8

我在IIS下使用PHP。我想更改错误行为并在用户请求非现有页面时重定向到某个页面。这是我创建的配置,但是当我请求不存在的URL时,它会返回500.19错误消息:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="Replace" errorMode="custom">
            <remove statusCode="404" />
            <error statusCode="404" path="index.php" responseMode="Redirect" />

            <remove statusCode="500" />
            <error statusCode="500" path="index.php" responseMode="Redirect" />
        </httpErrors>
    </system.webServer>
</configuration>

我应该更改什么才能将其重定向到index.php?

0 个答案:

没有答案
相关问题