服务器为不存在的页面报告200状态


Server reports a 200 status for non-existent pages

我使用CMS DEW POWER。当我输入错误的地址时,用户看到404页面,但服务器返回200。我的notfound.phtml:

<div class="text">
            <div class="lblock"><b>Requested URL was not found</b><br>
            <br>
            When trying to connect following error:<br>
            <ul class="list1">
                <li>Non-existent URL</li>
            </ul>
            <br>
            One element of the requested URL is incorrect. Possible problems:<br>
            <ul class="list1">
                <li>Missing or incorrect access protocol (should be "http://" or similar)</li>
                <li>No host name</li>
                <li>Illegal characters in path</li>
                <li>Illegal characters in the hostname, underscores banned</li>
            </ul>
            </div>
            <br>
            <br>
            <br>
            <div class="end">&nbsp;<br>

            &nbsp;</div>        <br><br><br>
    </div>

我试着在文档的开头插入下面的代码,但是没有帮助。

<?php
header("HTTP/1.0 404 Not Found");
?>
我的问题解决了。在SiteController中,我的notfoundAction看起来像这样:
function notfoundAction() {
        $this->view->notfound = 1;
        $this->view->section_name = '404';
        $this->view->inner_content = $this->view->partial('notfound.phtml');
        return $this->page_inner();
    }

我添加了HttpResponse:

$this->getResponse()->setHttpResponseCode(404);