| 
| 人氣點閱:17428 | 發表人 |  
| 
	| [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
 發表: 11298
 來自: vovo2000.com
 V幣: 902758
 |  
|  |  |  
|  | Type 
 
  
  繪圖畫廊  設計藝廊
  攝影相簿  留言板
  最愛收藏  分類標籤
 暱稱: Type
 註冊: 2002-11-30
 發表: 11298
 來自: vovo2000.com
 V幣: 902758
 |  
|  |  |  
|  | 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
 發表: 11298
 來自: vovo2000.com
 V幣: 902758
 |  
|  |  |  |  |  
 |