首頁 美術繪圖 | 美術設計 | 熱門標籤 | 首選 | 首頁宣傳 | 近期作品 論壇: 發表 | 美術工作 | 美術比賽 | 展覽活動 | 美術相關 | 一般討論 | 美術同好 CG 討論 :: Photoshop | Painter | 3D 行動 | AMP

【 立即註冊 】 : 更改個人資料 : : 登入

會員名稱: 登入密碼: 保持登入

[Web] Using Apache Error Document

發表新主題 回覆主題 討論區 Windows, Linux, Perl, PHP, C/C++, Driver, Web 理論、應用、硬體、軟體

| 1頁, 共1
人氣點閱:16756 發表人
[Web] Using Apache Error Document 2003-08-02 11:30
分類: ✔️apache ✔️errordocument ✔️404 ✔️403 ✔️E4C70F
個人: ✔️apache ✔️errordocument ✔️404 ✔️403 ✔️E4C70F
/ / /

Goal: Customized Web Error Message

Exp. Env: Vovo2000.Com ( Apache 2 + PHP )

Method:

1. 在 httpd.conf 建立
ErrorDocument 404 "/my/handle/path/myError.php?error=404"
當然,也可以用靜態網頁或純文字。(這裡好像 error code 不能用 RegEx?)

2. 寫一個 myError.php / perl (CGI) 去接
3. 寫好了,完成!(很簡單吧?~ )

另外, 2. 這個 PHP 如附件,可以 download
代碼:

<?PHP

     if (trim($HTTP_GET_VARS["error"]) != '')
   {
      $e = intval($HTTP_GET_VARS["error"]);
      $msg = "";
      $error_msg_2 = "<h1>".$e." ";
      $google404 = 0;
         
        switch ( $e )
      {
         case 403: $msg .=  'Forbidden';   break;
         case 404: $msg .= 'Not Found';   break;
         case 400: $msg .=  "Bad Request"; break;
         case 401: $msg .=  "Unauthorized"; break;
         case 402: $msg .=  "Payment Required"; break;
         case 405: $msg .=  "Method Not Allowed"; break;
         case 406: $msg .=  "Not Acceptable"; break;
         case 407: $msg .=  "Proxy Authentication Required"; break;
         case 408: $msg .=  "Request Timeout"; break;
         case 409: $msg .=  "Conflict"; break;
         case 410: $msg .=  "Gone"; break;
         case 411: $msg .=  "Length Required"; break;
         case 412: $msg .=  "Precondition Failed"; break;
         case 413: $msg .=  "Request Entity Too Large"; break;
         case 414: $msg .=  "Request-URI Too Long"; break;
         case 415: $msg .=  "Unsupported Media Type"; break;
         case 416: $msg .=  "Requested Range Not Satisfiable"; break;
         case 417: $msg .=  "Expectation Failed"; break;
         case 500: $msg .=  "Internal Server Error"; break;
         case 501: $msg .=  "Not Implemented"; break;
         case 502: $msg .=  "Bad Gateway"; break;
         case 503: $msg .=  "Service Unavailable"; break;
         case 504: $msg .=  "Gateway Timeout"; break;
         case 505: $msg .=  "HTTP Version Not Supported"; break;
         default:
            $msg .= "Error";
            break;
        }

        $msg1 = $msg;
      $msg .= "</h1>";
      $error_msg_2 .= $msg;
     }

   $part_main = '<head><title>{ERROR_MSG_1}</title></head><body bgcolor=#E4C70F>{ERROR_MSG_2}<a href=/>Vovo2000.Com</a><hr>';
   $part_main = str_replace( "{ERROR_MSG_1}", ($e." ".$msg1), $part_main );
   $part_main = str_replace( "{ERROR_MSG_2}", $error_msg_2, $part_main );
   $part_main .= '</body>';

   echo $part_main;
   
?>


參考文件:
[1] RFC 2616 HTTP 1.1, http://www.w3.org/Protocols/rfc2616/rfc2616.html
myERROR.php zipped
errordocument handling

myError.zip ... 欲下載此檔案,請先登入。 0.87 KB



________________

美術插畫設計案子報價系統 v0.1 Beta
爪哇禾雀
Type



繪圖畫廊設計藝廊
攝影相簿留言板
最愛收藏分類標籤
暱稱: Type
註冊: 2002-11-30
發表: 11085
來自: vovo2000.com
V幣: 900977
Re: [Web] Using Apache Error Document 2003-08-02 11:33
/ / /

他的效果如附件的圖~

以「403」為測試。

Page Not Found.
job_error_handle.jpg
job_error_handle.jpg



________________

美術插畫設計案子報價系統 v0.1 Beta
爪哇禾雀
Type



繪圖畫廊設計藝廊
攝影相簿留言板
最愛收藏分類標籤
暱稱: Type
註冊: 2002-11-30
發表: 11085
來自: vovo2000.com
V幣: 900977
Re: [Web] Using Apache Error Document 2004-07-22 17:02
/ / /

剛好在找這個,太感謝了 😊 😊 😊
ming



繪圖畫廊設計藝廊
攝影相簿留言板
最愛收藏分類標籤
暱稱: ming
註冊: 2003-12-24
發表: 54

V幣: 70
Re: [Web] Using Apache Error Document 2009-01-06 01:13
/ / /

增強 404 網頁



Google Sitemap webmaster
提供了另外一個 404 增強處理,各位參考一下

代碼:

<script type="text/javascript">
  var GOOG_FIXURL_LANG = 'zh-TW';
  var GOOG_FIXURL_SITE = 'https://vovo2000.com/';
</script>
<script type="text/javascript"
    src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>

________________

美術插畫設計案子報價系統 v0.1 Beta
爪哇禾雀
Type



繪圖畫廊設計藝廊
攝影相簿留言板
最愛收藏分類標籤
暱稱: Type
註冊: 2002-11-30
發表: 11085
來自: vovo2000.com
V幣: 900977





資訊相關理論、技術、管理、應用、產品等
發表新主題 回覆主題