1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
4 <!-- English Revision: 420990:1174747 (outdated) -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="mod_dir.xml.meta">
26 <description>「最後のスラッシュ」のリダイレクトと、ディレクトリの
27 インデックスファイルを扱う機能を提供する</description>
29 <sourcefile>mod_dir.c</sourcefile>
30 <identifier>dir_module</identifier>
33 <p>ディレクトリインデックスは、次の二つのうちどちらかが利用されます:</p>
36 <li>一つ目は、ユーザが作成したファイルを用いるもので、通常
37 <code>index.html</code> というファイル名を使います。このファイル名は、
38 <directive module="mod_dir">DirectoryIndex</directive> ディレクティブで
39 指定することができます。この機能は <module>mod_dir</module>
43 サーバによって自動的に生成されるディレクトリリストを用いる場合です。
44 この機能は、<module>mod_autoindex</module>
48 <p>自動的なインデックス生成機能を削除 (もしくは交換)
49 できるように、この二つの機能は分離されています。</p>
51 <p>なお <code>http://servername/foo/dirname</code> という URL
52 へのリクエストがあった際に、<code>dirname</code>
53 というディレクトリがあれば、「最後にスラッシュをつけた形」の URL
55 ディレクトリへのアクセスはスラッシュで終わっている必要があり、
56 <code>mod_dir</code> は、<code>http://servername/foo/dirname/</code>
57 へのリダイレクトを送出することになります。</p>
61 <name>DirectoryIndex</name>
62 <description>クライアントがディレクトリをリクエストしたときに調べる
63 リソースのリスト</description>
64 <syntax>DirectoryIndex
65 <var>local-url</var> [<var>local-url</var>] ...</syntax>
66 <default>DirectoryIndex index.html</default>
67 <contextlist><context>server config</context><context>virtual host</context>
68 <context>directory</context><context>.htaccess</context></contextlist>
69 <override>Indexes</override>
73 クライアントが、ディレクトリ名の最後に「/」
74 を指定してディレクトリインデックスを要求する場合に探すリソースのリストを
75 <directive>DirectoryIndex</directive> ディレクティブで設定します。
77 は、リクエストされたディレクトリに対応する、サーバ上のドキュメントの
78 (% エンコードされた) URL で、普通はディレクトリ中のファイルの名前です。
79 複数の URL が設定された場合には、最初に見つかったものを返します。
80 それらが見つからず、<code>Indexes</code>
81 オプションがセットされている場合、ディレクトリのリストを生成します。
84 <example><title>例</title>
85 DirectoryIndex index.html
88 <p><code>http://myserver/docs/</code> へのアクセスがあり、
89 <code>http://myserver/docs/index.html</code>
91 もし存在しなければ、ディレクトリのリストが返されます。</p>
93 <p>注: ドキュメントが同じディレクトリ内に存在するは必要ありません。
97 DirectoryIndex index.html index.txt /cgi-bin/index.pl
100 <p>とした場合、<code>index.html</code> と <code>index.txt</code>
101 のどちらもディレクトリ内に存在しない場合、CGI スクリプト
102 <code>/cgi-bin/index.pl</code> が実行されます。</p>
107 <name>DirectorySlash</name>
108 <description>パス末尾のスラッシュでリダイレクトするかどうかのオンオフをトグルさせる</description>
109 <syntax>DirectorySlash On|Off</syntax>
110 <default>DirectorySlash On</default>
111 <contextlist><context>server config</context><context>virtual host</context>
112 <context>directory</context><context>.htaccess</context></contextlist>
113 <override>Indexes</override>
114 <compatibility>2.0.51 以降</compatibility>
117 <p>要求のあった URL がディレクトリを指すかどうかを、
118 <module>mod_dir</module> が調整するべきかどうかを
119 <directive>DirectorySlash</directive>
122 <p>典型的には、ユーザが末尾のスラッシュ無しでリソースへのリクエストを発行し、
123 そして、そのリソースがディレクトリを指していた場合、<module>mod_dir</module>
124 は、末尾にスラッシュを<em>付加</em>した上で同じリソースにリダイレクトさせます。
125 この挙動には幾つか理由があります:</p>
128 <li>ユーザは、最終的にはリソースの別名 URL をリクエストすることになる。</li>
129 <li><module>mod_autoindex</module> が期待通りに動く。<module>mod_autoindex</module>
130 の生成するリンクはパスを出力しませんので、スラッシュがない場合は間違ったパスを
132 <li><directive module="mod_dir">DirectoryIndex</directive> は、
133 末尾にスラッシュがついているリクエストについて<em>のみ</em>評価される。</li>
134 <li>HTML ページの相対 URL 参照が正しく動作する。</li>
137 <p>とはいえ、もしこういった効果を望まない、かつ、
138 上記のような理由が当てはまらない場合は、リダイレクトを次のようにしてオフにできます:</p>
141 # see security warning below!<br />
142 <Location /some/path><br />
144 DirectorySlash Off<br />
145 SetHandler some-handler<br />
150 <note type="warning"><title>セキュリティ警告</title>
151 <p>末尾のスラッシュでのリダイレクトをオフにすると、結果的に情報漏洩を
153 <module>mod_autoindex</module> が有効 (<code>Options +Indexes</code>) で、
154 <directive module="mod_dir">DirectoryIndex</directive> が有効なリソース (例えば
155 <code>index.html</code>) を指していて、また、要求のあった URL に特別な
156 ハンドラが設定されていない場合を考えてみてください。
157 この場合末尾にスラッシュのついているリクエストに対しては <code>index.html</code>
158 ファイルが返されます。<strong>しかしスラッシュのないリクエストに対しては、
159 ディレクトリの内容一覧を返してしまいます。</strong></p>
165 <name>FallbackResource</name>
166 <description>Define a default URL for requests that don't map to a file</description>
167 <contextlist><context>server config</context><context>virtual host</context><context>directory</context><context>.htaccess</context></contextlist>
168 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>