FallbackResource in subdirectory
Solution 1:
I don't think this is possible to do easily. I've tried various combinations of DirectoryMatch
and LocationMatch
in the main configuration files using the newish variable interpolation available in these two directives.
Although something like FallBackResource index.html
is entirely valid configuration, I share Michael Hampton's concern that any use of relative URLs can cause problems. In the case of FallBackResource index.html
for a particular directory tree, index.html must always be present otherwise you will get the recursion loop you describe for requests where index.html
cannot be found.
In your case you would need a top level .htaccess
file with FallBackResource /index.html
, then FallBackResource /subfoldername/index.html
in each relevant sub folder.
A simple script to generate these is probably safest.