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
7      -->
8<title>mod_dir - 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">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body>
17<div id="page-header">
18<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/directives.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">用語</a> | <a href="/sitemap.html">サイトマップ</a></p>
19<p class="apache">Apache HTTP サーバ バージョン 2.2</p>
20<img alt="" src="/images/feather.gif" /></div>
21<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
22<div id="path">
23<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP サーバ</a> &gt; <a href="http://httpd.apache.org/docs/">ドキュメンテーション</a> &gt; <a href="../">バージョン 2.2</a> &gt; <a href="./">モジュール</a></div>
24<div id="page-content">
25<div id="preamble"><h1>Apache モジュール mod_dir</h1>
26<div class="toplang">
27<p><span>翻訳済み言語: </span><a href="/en/mod/mod_dir.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
28<a href="/ja/mod/mod_dir.html" title="Japanese">&nbsp;ja&nbsp;</a> |
29<a href="/ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
30<a href="/tr/mod/mod_dir.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
31</div>
32<div class="outofdate">この日本語訳はすでに古くなっている
33            可能性があります。
34            最近更新された内容を見るには英語版をご覧下さい。
35        </div>
36<table class="module"><tr><th><a href="module-dict.html#Description">説明:</a></th><td>「最後のスラッシュ」のリダイレクトと、ディレクトリの
37インデックスファイルを扱う機能を提供する</td></tr>
38<tr><th><a href="module-dict.html#Status">ステータス:</a></th><td>Base</td></tr>
39<tr><th><a href="module-dict.html#ModuleIdentifier">モジュール識別子:</a></th><td>dir_module</td></tr>
40<tr><th><a href="module-dict.html#SourceFile">ソースファイル:</a></th><td>mod_dir.c</td></tr></table>
41<h3>概要</h3>
42
43    <p>ディレクトリインデックスは、次の二つのうちどちらかが利用されます:</p>
44
45    <ul>
46      <li>一つ目は、ユーザが作成したファイルを用いるもので、通常
47      <code>index.html</code> というファイル名を使います。このファイル名は、
48      <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> ディレクティブで
49      指定することができます。この機能は <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code>
50      モジュールで提供されます。</li>
51
52      <li>もう一つの方法は、
53      サーバによって自動的に生成されるディレクトリリストを用いる場合です。
54      この機能は、<code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code>
55      モジュールにより提供されます。</li>
56    </ul>
57
58    <p>自動的なインデックス生成機能を削除 (もしくは交換)
59    できるように、この二つの機能は分離されています。</p>
60
61    <p>なお <code>http://servername/foo/dirname</code> という URL
62    へのリクエストがあった際に、<code>dirname</code>
63    というディレクトリがあれば、「最後にスラッシュをつけた形」の URL
64    へのリダイレクトを送出します。
65    ディレクトリへのアクセスはスラッシュで終わっている必要があり、
66    <code>mod_dir</code> は、<code>http://servername/foo/dirname/</code>
67    へのリダイレクトを送出することになります。</p>
68</div>
69<div id="quickview"><h3 class="directives">ディレクティブ</h3>
70<ul id="toc">
71<li><img alt="" src="/images/down.gif" /> <a href="#directoryindex">DirectoryIndex</a></li>
72<li><img alt="" src="/images/down.gif" /> <a href="#directoryslash">DirectorySlash</a></li>
73<li><img alt="" src="/images/down.gif" /> <a href="#fallbackresource">FallbackResource</a></li>
74</ul>
75<ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div>
76
77<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
78<div class="directive-section"><h2><a name="DirectoryIndex" id="DirectoryIndex">DirectoryIndex</a> <a name="directoryindex" id="directoryindex">ディレクティブ</a></h2>
79<table class="directive">
80<tr><th><a href="directive-dict.html#Description">説明:</a></th><td>クライアントがディレクトリをリクエストしたときに調べる
81リソースのリスト</td></tr>
82<tr><th><a href="directive-dict.html#Syntax">構文:</a></th><td><code>DirectoryIndex
83    <var>local-url</var> [<var>local-url</var>] ...</code></td></tr>
84<tr><th><a href="directive-dict.html#Default">デフォルト:</a></th><td><code>DirectoryIndex index.html</code></td></tr>
85<tr><th><a href="directive-dict.html#Context">コンテキスト:</a></th><td>サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess</td></tr>
86<tr><th><a href="directive-dict.html#Override">上書き:</a></th><td>Indexes</td></tr>
87<tr><th><a href="directive-dict.html#Status">ステータス:</a></th><td>Base</td></tr>
88<tr><th><a href="directive-dict.html#Module">モジュール:</a></th><td>mod_dir</td></tr>
89</table>
90    <p>
91    クライアントが、ディレクトリ名の最後に「/」
92    を指定してディレクトリインデックスを要求する場合に探すリソースのリストを
93    <code class="directive">DirectoryIndex</code> ディレクティブで設定します。
94    <var>Local-url</var>
95    は、リクエストされたディレクトリに対応する、サーバ上のドキュメントの
96    (% エンコードされた) URL で、普通はディレクトリ中のファイルの名前です。
97    複数の URL が設定された場合には、最初に見つかったものを返します。
98    それらが見つからず、<code>Indexes</code>
99    オプションがセットされている場合、ディレクトリのリストを生成します。
100    </p>
101
102    <div class="example"><h3>例</h3><p><code>
103      DirectoryIndex index.html
104    </code></p></div>
105
106    <p><code>http://myserver/docs/</code> へのアクセスがあり、
107    <code>http://myserver/docs/index.html</code>
108    が存在すれば、この URL が返されます。
109    もし存在しなければ、ディレクトリのリストが返されます。</p>
110
111    <p>注: ドキュメントが同じディレクトリ内に存在するは必要ありません。
112    </p>
113
114    <div class="example"><p><code>
115      DirectoryIndex index.html index.txt  /cgi-bin/index.pl
116    </code></p></div>
117
118    <p>とした場合、<code>index.html</code> と <code>index.txt</code>
119    のどちらもディレクトリ内に存在しない場合、CGI スクリプト
120    <code>/cgi-bin/index.pl</code> が実行されます。</p>
121
122</div>
123<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
124<div class="directive-section"><h2><a name="DirectorySlash" id="DirectorySlash">DirectorySlash</a> <a name="directoryslash" id="directoryslash">ディレクティブ</a></h2>
125<table class="directive">
126<tr><th><a href="directive-dict.html#Description">説明:</a></th><td>パス末尾のスラッシュでリダイレクトするかどうかのオンオフをトグルさせる</td></tr>
127<tr><th><a href="directive-dict.html#Syntax">構文:</a></th><td><code>DirectorySlash On|Off</code></td></tr>
128<tr><th><a href="directive-dict.html#Default">デフォルト:</a></th><td><code>DirectorySlash On</code></td></tr>
129<tr><th><a href="directive-dict.html#Context">コンテキスト:</a></th><td>サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess</td></tr>
130<tr><th><a href="directive-dict.html#Override">上書き:</a></th><td>Indexes</td></tr>
131<tr><th><a href="directive-dict.html#Status">ステータス:</a></th><td>Base</td></tr>
132<tr><th><a href="directive-dict.html#Module">モジュール:</a></th><td>mod_dir</td></tr>
133<tr><th><a href="directive-dict.html#Compatibility">互換性:</a></th><td>2.0.51 以降</td></tr>
134</table>
135    <p>要求のあった URL がディレクトリを指すかどうかを、
136    <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code> が調整するべきかどうかを
137    <code class="directive">DirectorySlash</code>
138    ディレクティブで設定します。</p>
139
140    <p>典型的には、ユーザが末尾のスラッシュ無しでリソースへのリクエストを発行し、
141    そして、そのリソースがディレクトリを指していた場合、<code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code>
142    は、末尾にスラッシュを<em>付加</em>した上で同じリソースにリダイレクトさせます。
143    この挙動には幾つか理由があります:</p>
144
145    <ul>
146    <li>ユーザは、最終的にはリソースの別名 URL をリクエストすることになる。</li>
147    <li><code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code> が期待通りに動く。<code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code> 
148    の生成するリンクはパスを出力しませんので、スラッシュがない場合は間違ったパスを
149    指してしまうことになります。</li>
150    <li><code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> は、
151    末尾にスラッシュがついているリクエストについて<em>のみ</em>評価される。</li>
152    <li>HTML ページの相対 URL 参照が正しく動作する。</li>
153    </ul>
154
155    <p>とはいえ、もしこういった効果を望まない、かつ、
156    上記のような理由が当てはまらない場合は、リダイレクトを次のようにしてオフにできます:</p>
157
158    <div class="example"><p><code>
159        # see security warning below!<br />
160        &lt;Location /some/path&gt;<br />
161        <span class="indent">
162            DirectorySlash Off<br />
163            SetHandler some-handler<br />
164        </span>
165        &lt;/Location&gt;
166    </code></p></div>
167
168    <div class="warning"><h3>セキュリティ警告</h3>
169    <p>末尾のスラッシュでのリダイレクトをオフにすると、結果的に情報漏洩を
170    招くことになるかもしれません。
171    <code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code> が有効 (<code>Options +Indexes</code>) で、
172    <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> が有効なリソース (例えば
173    <code>index.html</code>) を指していて、また、要求のあった URL に特別な
174    ハンドラが設定されていない場合を考えてみてください。
175    この場合末尾にスラッシュのついているリクエストに対しては <code>index.html</code>
176    ファイルが返されます。<strong>しかしスラッシュのないリクエストに対しては、
177    ディレクトリの内容一覧を返してしまいます。</strong></p>
178    </div>
179
180</div>
181<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
182<div class="directive-section"><h2><a name="FallbackResource" id="FallbackResource">FallbackResource</a> <a name="fallbackresource" id="fallbackresource">ディレクティブ</a></h2>
183<table class="directive">
184<tr><th><a href="directive-dict.html#Description">説明:</a></th><td>Define a default URL for requests that don't map to a file</td></tr>
185<tr><th><a href="directive-dict.html#Syntax">構文:</a></th><td><code>FallbackResource disabled | <var>local-url</var></code></td></tr>
186<tr><th><a href="directive-dict.html#Default">デフォルト:</a></th><td><code>None - httpd will return 404 (Not Found)</code></td></tr>
187<tr><th><a href="directive-dict.html#Context">コンテキスト:</a></th><td>サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess</td></tr>
188<tr><th><a href="directive-dict.html#Override">上書き:</a></th><td>Indexes</td></tr>
189<tr><th><a href="directive-dict.html#Status">ステータス:</a></th><td>Base</td></tr>
190<tr><th><a href="directive-dict.html#Module">モジュール:</a></th><td>mod_dir</td></tr>
191<tr><th><a href="directive-dict.html#Compatibility">互換性:</a></th><td>Apache HTTP Server 2.2.16 and later - The <code>disabled</code> argument
192is supported since 2.2.24</td></tr>
193</table><p>このディレクティブの解説文書は
194            まだ翻訳されていません。英語版をご覧ください。
195            </p></div>
196</div>
197<div class="bottomlang">
198<p><span>翻訳済み言語: </span><a href="/en/mod/mod_dir.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
199<a href="/ja/mod/mod_dir.html" title="Japanese">&nbsp;ja&nbsp;</a> |
200<a href="/ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
201<a href="/tr/mod/mod_dir.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
202</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&amp;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>
203<script type="text/javascript"><!--//--><![CDATA[//><!--
204var comments_shortname = 'httpd';
205var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/mod_dir.html';
206(function(w, d) {
207    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
208        d.write('<div id="comments_thread"><\/div>');
209        var s = d.createElement('script');
210        s.type = 'text/javascript';
211        s.async = true;
212        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
213        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
214    }
215    else { 
216        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
217    }
218})(window, document);
219//--><!]]></script></div><div id="footer">
220<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>
221<p class="menu"><a href="/mod/">モジュール</a> | <a href="/mod/directives.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[//><!--
222if (typeof(prettyPrint) !== 'undefined') {
223    prettyPrint();
224}
225//--><!]]></script>
226</body></html>