404 ErrorDocument问题

时间:2010-05-31 22:05:31

标签: .htaccess http-status-code-404 errordocument

我已配置 .htaccess

  

ErrorDocument 404 error.php

但每当我转到一个无效页面时,它应显示404页面,但它只显示:

  

“error.php”

只是空白,只是php文件的文本......

文件和.htaccess确实存在。

内部错误.php:

<?php $title = "Error 404 - Page Not Found"; include("include/glob_header.php"); ?>

<div class="content_wrap">
    <div class="main_content_wrap">
        <div class="main_content">
            <h2>Error 404 - Page Not Found</h2>

            <p><div align="center"><img src="img/HS.gif" alt="" /></div><hr /></p>

            <p>The page you have requested could not be found.</p>

            <ul>
                <li>The page you were looking for may have been deleted...</li>
                <li>The page may have been moved...</li>
                <li>... or possibly the page does not even exist!</li>
            </ul>

            <p>Click <a href="index.php">here</a> to go back to the home page</p>

            <p>... or go back the <a href="javascript: history.go(-1);">previous</a> page</p>

        </div>
    </div>

    <div class="sidebar_content_wrap">
        <div class="sidebar_content">
            <h2>Latest News</h2>

            <?php include("include/glob_sidebar.php"); ?>  

        </div>
    </div>
</div>

<?php include("include/glob_footer.php"); ?>

3 个答案:

答案 0 :(得分:3)

你的error.php里面有什么?

也许还会在你的htaccess中添加一个斜杠

ErrorDocument 404 /error.php

答案 1 :(得分:1)

正如哈利所说,可能需要使用斜杠,但是您需要将它从.htaccess文件中传到文件的完整路径。

例如,如果您的error.php在目录中,它应如下所示:

ErrorDocument 404 /folder/error.php

答案 2 :(得分:0)

我认为您需要配置allowoverwrite