簡體   English   中英

使用ErrorDocument httpd.conf時出現問題

[英]Problems using ErrorDocument httpd.conf

我希望使用httpd.conf文件*創建ErrorDocument處理程序,以將用戶重定向到某個網站。 錯誤頁面上的代碼是:

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

我使用的語法是:ErrorDocument 404 /error.php,而error.php與httpd.conf文件位於同一目錄中。 重新啟動服務器后,錯誤404頁面顯示“未找到

在此服務器上找不到請求的URL / 404page。

此外,嘗試使用ErrorDocument處理請求時遇到了404 Not Found錯誤。”

我應該使用什么路徑? *我想使用httpd.conf文件,而不是.htaccess文件。

嘗試這個

在此處閱讀有關http狀態代碼的信息http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

# 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

我通過將文件放在相對於httpd.conf文件的目錄中解決了該問題:
ErrorDocument 404 /error/index.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM