我将如何能够正确地将访问我的网站的人redirect到我的404页面? 我已经创build了我的404.php文件为:
<!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Page not found | Twilight of Spirits</title> <link rel="stylesheet" href="http://forum.umbradora.net/template/default/css/404.css"> <link rel="icon" type="image/x-icon" href="/favicon.png"> </head> <body> <div id="error"> <a href="http://forum.umbradora.net/"> <img src="/forum/template/default/images/layout/404.png" alt="404 page not found" id="error404-image"> </a> </div> <div id="mixpanel" style="visibility: hidden; "></div></body></html>
我的.htaccess文件是:
ErrorDocument 404 http://forum.umbradora.net/404.php
现在,当我去我的网站,并input一个错误的链接,如mack.php或total.html,我得到这个错误:
内部服务器错误服务器遇到内部错误或configuration错误,无法完成您的请求。 请联系服务器pipe理员[email protected],告诉他们错误发生的时间,以及可能导致错误的任何事情。 有关此错误的更多信息可能在服务器错误日志中可用。 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。
任何想法如何解决这个问题? 我曾尝试从子域切换到我的正常path,仍然得到错误。
我不知道它是否解决了你的问题,但你应该在你的网站上设置404头。
<?php header("HTTP/1.0 404 Not Found"); ..... ?>
也许你的网站有错误。 检查Apache的错误日志获取更多的信息。
https://stackoverflow.com/questions/5534268/headerhttp-1-0-404-not-found-not-doing-anything
你必须提供一个本地path,例如ErrorDocument 404 404.php 。
如果我没有记错的话,404文档可能不会指向完整的URL,只能是相对path。