Php 使用ErrorDocument httpd.conf时出现问题

Php 使用ErrorDocument httpd.conf时出现问题,php,apache,httpd.conf,Php,Apache,Httpd.conf,使用httpd.conf文件*,我希望创建ErrorDocument处理程序,将用户重定向到某个网站。错误页面上的代码为: <?php header("Location: http://www.mydomain.com/?error=true"); ?> 我使用的语法是:errordocument404/error.php,error.php与httpd.conf文件位于同一目录中。重新启动服务器后,错误404页面显示 “没有找到 在此服务器上找不到请求的URL/404页 此外

使用httpd.conf文件*,我希望创建ErrorDocument处理程序,将用户重定向到某个网站。错误页面上的代码为:

<?php
header("Location: http://www.mydomain.com/?error=true");
?>

我使用的语法是:errordocument404/error.php,error.php与httpd.conf文件位于同一目录中。重新启动服务器后,错误404页面显示 “没有找到

在此服务器上找不到请求的URL/404页

此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。“

我应该走哪条路? *我想使用httpd.conf文件,而不是.htaccess。

试试这个

请阅读此处有关http状态代码的信息


我通过将文件放在与httpd.conf文件相对的目录中解决了这个问题:
ErrorDocument 404/error/index.php

# Some examples:
ErrorDocument 500 "The server made a boo boo."
ErrorDocument 404 /missing.html
ErrorDocument 404 "/cgi-bin/missing_handler.pl"
ErrorDocument 402 http://www.example.com/subscription_info.html