Question

Context

I have Apache 2.2.15 configured for mass virtual hosting as follows:

<VirtualHost *:80>
    # ...irrelevant lines omitted
    VirtualDocumentRoot /srv/www/%-3+
    ServerName example.com
    ServerAlias localhost
</VirtualHost>

mkdir /srv/www/foo makes foo.example.com available.


Problem

HTTP 500 from all of foo.example.com when a .htaccess containing only a FallbackResource directive is in the vhost document root. Commenting out FallbackResource removes the error, but I want to use FallbackResource.


Stuff tried

I confirmed the relevant module was loaded using httpd -M | grep dir_module. Oddly enough I still see Invalid command 'FallbackResource', perhaps misspelled or defined by a module not included in the server configuration in the error log.

The filesystem is as simple as possible. There is only a "Hello, World" index.php and a .htaccess. Yes, permissions are fine.

/srv/www
    foo
        index.php <- 775, owned by apache
        .htaccess <- 664, owned by apache

I tried each of the following in .htaccess:

  • FallbackResource index.php
  • FallbackResource /index.php
  • FallbackResource foo/index.php
  • FallbackResource /foo/index.php

Also tried <Directory /srv/www/foo> even though that would not have worked anyway.

New stuff tried given comments below

  • AllowOverride Indexes raises AllowOverride not allowed here when entered into <VirtualHost> container.
  • Confirmed LoadModule dir_module modules/mod_dir.so is in httpd.conf

Anything stupid/obvious I am missing?

Was it helpful?

Solution

The FallbackResource directive wasn't introduced until 2.2.16 as described here. Upgrading Apache should solve your problem.

OTHER TIPS

In order to use FallbackResource in an htaccess file you need to allow the Indexes override. See the mod_dir documentation. Try adding the override in your vhost config:

AllowOverride Indexes

You should also try looking in apache's error logs to see what's causing the 500 server error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top