FallbackResource on Apache2 (2.2.22 (Ubuntu))
I'm trying to clean up my apache vhosts, since I've got a number of 'Alias's in place, and putting them all into a mod_rewrite can be annoying. However, while I can get to specific URLs (such as http://example.dev/robots.txt, http://example.dev/ on its own, the vhost will not fall back to the listed URL ( FallbackResource /index.php
).
The vhost is a container for a Zend Framework project, and no .htaccess files are set.
The access log shows .... "GET / HTTP/1.1" 302 0
, but Google Chrome is showing 'No data received' and 'Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.'
Commenting out the FallbackResource
line, and re-enabling the <Location />
-based mod_rewrite works as expected though.
EDIT: There is nothing in the vhost that I can see to stop it from working. A few Alias
lines (which FallbackResource is supposed to work with) and some FilesMatch
to stop access to file with particular extensions. The only thing appearing in the logs is the 404 when it's trying to go to the URL and not to index.php (the listed resource).
<VirtualHost *:80>
ServerAdmin webmaster@site.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/website/current/html/
SetEnv APPLICATION_ENV productionbackend
# must be most specific first
Alias /i/static /var/website/static/i
# more /i/* Alias
Alias /i /var/website/current/resources/common-furniture/
# protecting files in the directory.
<FilesMatch ".*.xml">
Order allow,deny
Deny from all
</FilesMatch>
<Directory "/var/website/current/html/">
Options FollowSymLinks All
AllowOverride All
</Directory>
ErrorLog logs/error.log
CustomLog logs/access.log common
</VirtualHost>
I have a solution. As I said in my comment on the original question, I'm also having the same problem. My vhost is ultra simple:
<VirtualHost *:8029>
DocumentRoot "C:pathtowwwroot"
ServerName localhost
<Directory />
AllowOverride All
</Directory>
</VirtualHost>
and my htaccess only contains:
FallbackResource index.html
I have added DirectoryIndex
to my .htaccess file. It now reads:
FallbackResource /index.html
DirectoryIndex index.html
This has solved the problem.
Why does this work?
The empty response only occurred when the /
url was called the second time and it was cached by the browser. For some reason, it seems that FallbackResource
fails in this instance, so I figured that by ensuring that the index.html is served via specifying DirectoryIndex
, there would be no need for a fallback. You could call this a workaround.