I've set up my virtual host on Apache 2.4.7 with a very basic configuration:
<VirtualHost *:80>
ServerName foo.example.com
DocumentRoot /var/www/html
DirectoryIndex index.php
FallbackResource /index.php
</VirtualHost>
Underneath the document root I have the following structure:
/index.php
/help/readme.txt
I get the following results when I make requests:
/bla -> 200 OK
/help/ -> 404 Not Found
/help/a -> 200 OK
It seems that the existence of the /help/
directory is causing Apache to return 404
because there's no index.php
in there, but I expect all requests to invoke /index.php
and thus yield a 200 OK
response.
I don't remember this being a problem when using mod_rewrite
, but I prefer using FallbackResource
if possible. Is there a way to fix this?
Update
It works if I remove the DirectoryIndex
directive, but that suffers from five second delay issues.
Update 3
I'm running the following test environment; the directory structure is as follows:
./htdocs
index.html
test/
bla.txt
./conf
httpd.conf
./logs
The contents of httpd.conf
is:
ServerName apache-bug.local
Listen 8085
DirectoryIndex disabled
DirectorySlash Off
<VirtualHost *:8085>
DocumentRoot /home/user/apache-bug/htdocs
FallbackResource /index.html
</VirtualHost>
My config.nice
contains:
"./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" \
"$@"
To run the server:
httpd -X -d /home/user/work/apache-bug/