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 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 This file is generated from xml source: DO NOT EDIT
8 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10 <title>カスタムエラーレスポンス - Apache HTTP サーバ バージョン 2.5</title>
11 <link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <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" />
14 <script src="./style/scripts/prettify.min.js" type="text/javascript">
17 <link href="./images/favicon.ico" rel="shortcut icon" /></head>
18 <body id="manual-page"><div id="page-header">
19 <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>
20 <p class="apache">Apache HTTP サーバ バージョン 2.5</p>
21 <img alt="" src="./images/feather.png" /></div>
22 <div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div>
24 <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>
26 <p><span>翻訳済み言語: </span><a href="./en/custom-error.html" hreflang="en" rel="alternate" title="English"> en </a> |
27 <a href="./es/custom-error.html" hreflang="es" rel="alternate" title="Español"> es </a> |
28 <a href="./fr/custom-error.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
29 <a href="./ja/custom-error.html" title="Japanese"> ja </a> |
30 <a href="./ko/custom-error.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
31 <a href="./tr/custom-error.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
33 <div class="outofdate">この日本語訳はすでに古くなっている
35 最近更新された内容を見るには英語版をご覧下さい。
38 <p>ウェブマスターが何らかのエラーや問題に対する
39 Apache の反応を設定できるようにする追加機能を提供します。</p>
41 <p>サーバがエラーや問題を発見した場合の反応を、
42 カスタマイズして定義することができます。</p>
44 <p>スクリプトの実行が失敗して "500 Server Error"
45 を発生させたとします。この場合の反応を、より好ましいテキストや、別の
46 URL (内部及び外部) へのリダイレクションに置き換えることができます。
49 <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#behavior">動作</a></li>
50 <li><img alt="" src="./images/down.gif" /> <a href="#configuration">設定</a></li>
51 <li><img alt="" src="./images/down.gif" /> <a href="#custom">カスタムエラーレスポンスとリダイレクト</a></li>
52 </ul><h3>参照</h3><ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div>
53 <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
55 <h2><a name="behavior" id="behavior">動作</a></h2>
61 <p>NCSA httpd 1.3 は、古くて退屈なエラー/問題メッセージを
62 返していました。それはしばしばユーザには無意味であり、
63 またそれを発生させた原因を記録する方法も提供していませんでした。</p>
70 <li>NCSA のハードコードされたメッセージの代わりに
73 <li>ローカルの URL にリダイレクト</li>
75 <li>外部の URL にリダイレクト</li>
78 <p>するようにサーバを設定できます。</p>
80 <p>別の URL にリダイレクトすることは役に立ちますが、
81 それは説明をしたり、より明確に誤り/問題を記録したりするために
82 何か情報を伝えられるときに限ります。</p>
84 <p>これを実現するために、 Apache は新しく CGI のような環境変数を
87 <div class="example"><p><code>
88 REDIRECT_HTTP_ACCEPT=*/*, image/gif,
89 image/x-xbitmap, image/jpeg<br />
90 REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX
91 A.09.05 9000/712)<br />
92 REDIRECT_PATH=.:/bin:/usr/local/bin:/etc<br />
93 REDIRECT_QUERY_STRING=<br />
94 REDIRECT_REMOTE_ADDR=121.345.78.123<br />
95 REDIRECT_REMOTE_HOST=ooh.ahhh.com<br />
96 REDIRECT_SERVER_NAME=crash.bang.edu<br />
97 REDIRECT_SERVER_PORT=80<br />
98 REDIRECT_SERVER_SOFTWARE=Apache/0.8.15<br />
99 REDIRECT_URL=/cgi-bin/buggy.pl
102 <p>頭に付く <code>REDIRECT_</code> に注目してください。</p>
104 <p>少なくとも <code>REDIRECT_URL</code> と
105 <code>REDIRECT_QUERY_STRING</code> は新しい URL (CGI スクリプトか
106 CGI インクルードであると仮定されます) に渡されます。
107 他の変数は、エラーや問題が起きる前に存在した場合にだけ存在します。
108 もしあなたの設定した <code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code> が <em>外部</em>リダイレクト
109 (<em>すなわち</em>、<code>http:</code>
110 のような体系名から始まるすべてのもの。たとえ同じホストを指していても)
111 ならば、これらは<strong>まったく</strong>設定されません。</p>
113 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
114 <div class="section">
115 <h2><a name="configuration" id="configuration">設定</a></h2>
118 <p><code class="directive"><a href="./mod/core.html#allowoverride">AllowOverride</a></code> が適切に設定されていれば、
119 .htaccess ファイルで <code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code>
122 <p>ここに、いくつかの例を挙げます。</p>
124 <div class="example"><p><code>
125 ErrorDocument 500 /cgi-bin/crash-recover <br />
126 ErrorDocument 500 "Sorry, our script crashed. Oh dear" <br />
127 ErrorDocument 500 http://xxx/ <br />
128 ErrorDocument 404 /Lame_excuses/not_found.html <br />
129 ErrorDocument 401 /Subscription/how_to_subscribe.html
134 <div class="example"><p><code>
135 ErrorDocument <3-digit-code> <action>
138 <p>action (動作) は、下記のいずれかです</p>
141 <li>表示するテキスト。テキストは引用符 (") で囲んで指定します。</li>
143 <li>リダイレクト先の外部 URL </li>
145 <li>リダイレクト先のローカル URL </li>
147 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
148 <div class="section">
149 <h2><a name="custom" id="custom">カスタムエラーレスポンスとリダイレクト</a></h2>
152 <p>スクリプト/SSI に追加の環境変数が利用可能になるように、
153 リダイレクトされた URL に対する Apache の動作が変更されました。</p>
158 <p>リダイレクトされたスクリプトは標準の CGI
159 環境変数を利用可能でした。しかし、どこからリダイレクト
160 されたかの情報は提供されていませんでした。</p>
166 <p>リダイレクトされた先のスクリプトが使用可能なように、
167 新しいたくさんの環境変数が初期化されます。新しい変数は、それぞれ
168 <code>REDIRECT_</code> で始まります。
169 <code>REDIRECT_</code> で始まる環境変数はリダイレクトされる前に存在していた
170 CGI 環境変数の頭に <code>REDIRECT_</code> を付けて作成されます。
171 <em>すなわち</em>、<code>HTTP_USER_AGENT</code> は
172 <code>REDIRECT_HTTP_USER_AGENT</code> になります。
173 これらの新しい変数に加えて、Apache は、
174 スクリプトがリダイレクト元のトレースを助けるために
175 <code>REDIRECT_URL</code> と <code>REDIRECT_STATUS</code>
176 を定義します。アクセスログには元の URL とリダイレクトされた URL
179 <p>ErrorDocument が CGI スクリプトへのローカルリダイレクトを
180 指定している場合は、それを起動することになったエラーの状態を
181 クライアントまで確実に伝えるために <code>"Status:" </code>
182 ヘッダを含むべきです。例えば、ErrorDocument 用の Perl
183 スクリプトは以下のようなものを含むかもしれません。
186 <div class="example"><p><code>
188 print "Content-type: text/html\n"; <br />
189 printf "Status: %s Condition Intercepted\n", $ENV{"REDIRECT_STATUS"}; <br />
193 <p>スクリプトが <code>404 Not Found</code> のような
194 特定のエラーコンディションを扱うためだけに使われる場合は、
195 代わりに特定のコードとエラーテキストを使用することができます。</p>
198 <div class="bottomlang">
199 <p><span>翻訳済み言語: </span><a href="./en/custom-error.html" hreflang="en" rel="alternate" title="English"> en </a> |
200 <a href="./es/custom-error.html" hreflang="es" rel="alternate" title="Español"> es </a> |
201 <a href="./fr/custom-error.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
202 <a href="./ja/custom-error.html" title="Japanese"> ja </a> |
203 <a href="./ko/custom-error.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
204 <a href="./tr/custom-error.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
205 </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>
206 <script type="text/javascript"><!--//--><![CDATA[//><!--
207 var comments_shortname = 'httpd';
208 var comments_identifier = 'http://httpd.apache.org/docs/trunk/custom-error.html';
210 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
211 d.write('<div id="comments_thread"><\/div>');
212 var s = d.createElement('script');
213 s.type = 'text/javascript';
215 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
216 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
219 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
221 })(window, document);
222 //--><!]]></script></div><div id="footer">
223 <p class="apache">Copyright 2016 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p>
224 <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[//><!--
225 if (typeof(prettyPrint) !== 'undefined') {