非常に基本的な構成でApache 2.4.7に仮想ホストを設定しました。
<VirtualHost *:80>
ServerName foo.example.com
DocumentRoot /var/www/html
DirectoryIndex index.php
FallbackResource /index.php
</VirtualHost>
ドキュメントルートの下には、次の構造があります。
/index.php
/help/readme.txt
リクエストすると次のような結果になります。
/bla -> 200 OK
/help/ -> 404 Not Found
/help/a -> 200 OK
/help/
ディレクトリが存在し404
ないため、Apacheにディレクトリが存在しないため、Apacheが戻ってきたようですindex.php
が、すべてのリクエストが呼び出され/index.php
、200 OK
応答が返されることを期待しています。
を使用するときにこれが問題であったことは覚えていませんが、可能であればmod_rewrite
使用FallbackResource
することをお勧めします。これを修正する方法はありますか?
更新
DirectoryIndex
ディレクティブを削除すれば機能しますが、5秒の遅延の問題があります。
アップデート3
次のテスト環境を実行しています。ディレクトリ構造は次のとおりです。
./htdocs
index.html
test/
bla.txt
./conf
httpd.conf
./logs
の内容httpd.conf
は次のとおりです。
ServerName apache-bug.local
Listen 8085
DirectoryIndex disabled
DirectorySlash Off
<VirtualHost *:8085>
DocumentRoot /home/user/apache-bug/htdocs
FallbackResource /index.html
</VirtualHost>
私config.nice
が含む:
"./configure" \
"--enable-debugger-mode" \
"--with-apr=/usr/local/apr/bin/apr-1-config" \
"--enable-dir=static" \
"--with-mpm=prefork" \
"--enable-unixd=static" \
"--enable-authn-core=static" \
"--enable-authz-core=static" \
"$@"
サーバーを実行するには:
httpd -X -d /home/user/work/apache-bug/
/bla
ますか?