404 Error文档问题

发布于 2024-09-03 07:20:04 字数 1636 浏览 4 评论 0原文

我已经配置了 .htaccess

ErrorDocument 404 error.php

但是每当我进入无效页面时,它应该显示 404 页面,但它只显示:

“错误.php”

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

该文件和 .htaccess 确实存在。

error.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"); ?>

I have .htaccess already configured:

ErrorDocument 404 error.php

But whenever I go to an invalid page, it should display the 404 page, but it just shows:

"error.php"

Just blank white, just the text of the php file only...

The file and .htaccess does exist.

Inside error.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"); ?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淤浪 2024-09-10 07:20:04

你的 error.php 里面有什么?

也许还可以在 htaccess 中添加斜杠

ErrorDocument 404 /error.php

What's inside your error.php ?

Maybe also add a slash in your htaccess

ErrorDocument 404 /error.php
宫墨修音 2024-09-10 07:20:04

正如 Harry 所说,可能需要斜杠,但您需要将其指向 .htaccess 文件中的文件的完整路径。

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

ErrorDocument 404 /folder/error.php

As Harry said, the slash may be needed, but you would need it to the full path to the file from the .htaccess file.

For example, if your error.php is in a directory, it should look like this:

ErrorDocument 404 /folder/error.php

养猫人 2024-09-10 07:20:04

我认为你需要配置allowoverwrite

I think you need to config the allowoverwrite

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文