1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>カスタムエラーレスポンス - Apache HTTP サーバ</title>
9 <link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" />
12 <script src="./style/scripts/prettify.js" type="text/javascript">
15 <link href="./images/favicon.ico" rel="shortcut icon" /></head>
16 <body id="manual-page"><div id="page-header">
17 <p class="menu"><a href="./mod/">モジュール</a> | <a href="./mod/quickreference.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">用語</a> | <a href="./sitemap.html">サイトマップ</a></p>
18 <p class="apache">Apache HTTP サーバ バージョン 2.5</p>
19 <img alt="" src="./images/feather.gif" /></div>
20 <div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div>
22 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP サーバ</a> > <a href="http://httpd.apache.org/docs/">ドキュメンテーション</a> > <a href="./">バージョン 2.5</a></div><div id="page-content"><div id="preamble"><h1>カスタムエラーレスポンス</h1>
24 <p><span>翻訳済み言語: </span><a href="./en/custom-error.html" hreflang="en" rel="alternate" title="English"> en </a> |
25 <a href="./es/custom-error.html" hreflang="es" rel="alternate" title="Español"> es </a> |
26 <a href="./fr/custom-error.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
27 <a href="./ja/custom-error.html" title="Japanese"> ja </a> |
28 <a href="./ko/custom-error.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
29 <a href="./tr/custom-error.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
31 <div class="outofdate">この日本語訳はすでに古くなっている
33 最近更新された内容を見るには英語版をご覧下さい。
36 <p>ウェブマスターが何らかのエラーや問題に対する
37 Apache の反応を設定できるようにする追加機能を提供します。</p>
39 <p>サーバがエラーや問題を発見した場合の反応を、
40 カスタマイズして定義することができます。</p>
42 <p>スクリプトの実行が失敗して "500 Server Error"
43 を発生させたとします。この場合の反応を、より好ましいテキストや、別の
44 URL (内部及び外部) へのリダイレクションに置き換えることができます。
47 <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#behavior">動作</a></li>
48 <li><img alt="" src="./images/down.gif" /> <a href="#configuration">設定</a></li>
49 <li><img alt="" src="./images/down.gif" /> <a href="#custom">カスタムエラーレスポンスとリダイレクト</a></li>
50 </ul><ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div>
51 <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
53 <h2><a name="behavior" id="behavior">動作</a></h2>
59 <p>NCSA httpd 1.3 は、古くて退屈なエラー/問題メッセージを
60 返していました。それはしばしばユーザには無意味であり、
61 またそれを発生させた原因を記録する方法も提供していませんでした。</p>
68 <li>NCSA のハードコードされたメッセージの代わりに
71 <li>ローカルの URL にリダイレクト</li>
73 <li>外部の URL にリダイレクト</li>
76 <p>するようにサーバを設定できます。</p>
78 <p>別の URL にリダイレクトすることは役に立ちますが、
79 それは説明をしたり、より明確に誤り/問題を記録したりするために
80 何か情報を伝えられるときに限ります。</p>
82 <p>これを実現するために、 Apache は新しく CGI のような環境変数を
85 <div class="example"><p><code>
86 REDIRECT_HTTP_ACCEPT=*/*, image/gif,
87 image/x-xbitmap, image/jpeg<br />
88 REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX
89 A.09.05 9000/712)<br />
90 REDIRECT_PATH=.:/bin:/usr/local/bin:/etc<br />
91 REDIRECT_QUERY_STRING=<br />
92 REDIRECT_REMOTE_ADDR=121.345.78.123<br />
93 REDIRECT_REMOTE_HOST=ooh.ahhh.com<br />
94 REDIRECT_SERVER_NAME=crash.bang.edu<br />
95 REDIRECT_SERVER_PORT=80<br />
96 REDIRECT_SERVER_SOFTWARE=Apache/0.8.15<br />
97 REDIRECT_URL=/cgi-bin/buggy.pl
100 <p>頭に付く <code>REDIRECT_</code> に注目してください。</p>
102 <p>少なくとも <code>REDIRECT_URL</code> と
103 <code>REDIRECT_QUERY_STRING</code> は新しい URL (CGI スクリプトか
104 CGI インクルードであると仮定されます) に渡されます。
105 他の変数は、エラーや問題が起きる前に存在した場合にだけ存在します。
106 もしあなたの設定した <code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code> が <em>外部</em>リダイレクト
107 (<em>すなわち</em>、<code>http:</code>
108 のような体系名から始まるすべてのもの。たとえ同じホストを指していても)
109 ならば、これらは<strong>まったく</strong>設定されません。</p>
111 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
112 <div class="section">
113 <h2><a name="configuration" id="configuration">設定</a></h2>
116 <p><code class="directive"><a href="./mod/core.html#allowoverride">AllowOverride</a></code> が適切に設定されていれば、
117 .htaccess ファイルで <code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code>
120 <p>ここに、いくつかの例を挙げます。</p>
122 <div class="example"><p><code>
123 ErrorDocument 500 /cgi-bin/crash-recover <br />
124 ErrorDocument 500 "Sorry, our script crashed. Oh dear" <br />
125 ErrorDocument 500 http://xxx/ <br />
126 ErrorDocument 404 /Lame_excuses/not_found.html <br />
127 ErrorDocument 401 /Subscription/how_to_subscribe.html
132 <div class="example"><p><code>
133 ErrorDocument <3-digit-code> <action>
136 <p>action (動作) は、下記のいずれかです</p>
139 <li>表示するテキスト。テキストは引用符 (") で囲んで指定します。</li>
141 <li>リダイレクト先の外部 URL </li>
143 <li>リダイレクト先のローカル URL </li>
145 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
146 <div class="section">
147 <h2><a name="custom" id="custom">カスタムエラーレスポンスとリダイレクト</a></h2>
150 <p>スクリプト/SSI に追加の環境変数が利用可能になるように、
151 リダイレクトされた URL に対する Apache の動作が変更されました。</p>
156 <p>リダイレクトされたスクリプトは標準の CGI
157 環境変数を利用可能でした。しかし、どこからリダイレクト
158 されたかの情報は提供されていませんでした。</p>
164 <p>リダイレクトされた先のスクリプトが使用可能なように、
165 新しいたくさんの環境変数が初期化されます。新しい変数は、それぞれ
166 <code>REDIRECT_</code> で始まります。
167 <code>REDIRECT_</code> で始まる環境変数はリダイレクトされる前に存在していた
168 CGI 環境変数の頭に <code>REDIRECT_</code> を付けて作成されます。
169 <em>すなわち</em>、<code>HTTP_USER_AGENT</code> は
170 <code>REDIRECT_HTTP_USER_AGENT</code> になります。
171 これらの新しい変数に加えて、Apache は、
172 スクリプトがリダイレクト元のトレースを助けるために
173 <code>REDIRECT_URL</code> と <code>REDIRECT_STATUS</code>
174 を定義します。アクセスログには元の URL とリダイレクトされた URL
177 <p>ErrorDocument が CGI スクリプトへのローカルリダイレクトを
178 指定している場合は、それを起動することになったエラーの状態を
179 クライアントまで確実に伝えるために <code>"Status:" </code>
180 ヘッダを含むべきです。例えば、ErrorDocument 用の Perl
181 スクリプトは以下のようなものを含むかもしれません。
184 <div class="example"><p><code>
186 print "Content-type: text/html\n"; <br />
187 printf "Status: %s Condition Intercepted\n", $ENV{"REDIRECT_STATUS"}; <br />
191 <p>スクリプトが <code>404 Not Found</code> のような
192 特定のエラーコンディションを扱うためだけに使われる場合は、
193 代わりに特定のコードとエラーテキストを使用することができます。</p>
196 <div class="bottomlang">
197 <p><span>翻訳済み言語: </span><a href="./en/custom-error.html" hreflang="en" rel="alternate" title="English"> en </a> |
198 <a href="./es/custom-error.html" hreflang="es" rel="alternate" title="Español"> es </a> |
199 <a href="./fr/custom-error.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
200 <a href="./ja/custom-error.html" title="Japanese"> ja </a> |
201 <a href="./ko/custom-error.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
202 <a href="./tr/custom-error.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
203 </div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">コメント</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
204 <script type="text/javascript"><!--//--><![CDATA[//><!--
205 var comments_shortname = 'httpd';
206 var comments_identifier = 'http://httpd.apache.org/docs/trunk/custom-error.html';
208 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
209 d.write('<div id="comments_thread"><\/div>');
210 var s = d.createElement('script');
211 s.type = 'text/javascript';
213 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
214 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
217 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
219 })(window, document);
220 //--><!]]></script></div><div id="footer">
221 <p class="apache">Copyright 2013 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p>
222 <p class="menu"><a href="./mod/">モジュール</a> | <a href="./mod/quickreference.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">用語</a> | <a href="./sitemap.html">サイトマップ</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
223 if (typeof(prettyPrint) !== 'undefined') {