Fallback resource overview
I started web development on a Mac, and later bought a Windows computer. When I ran a testing server on the Mac, it automatically used the nearest index file if the file you requested didn't exist (at least that's how I thought it worked, but I didn't have much server experience at that point and I could have been totally wrong).
When I installed Apache on my windows computer, I tried to replicate that behavior. But I had no idea what to search for due to my inexperience with servers.
Luckily I stumbled across the solution, and found it really useful when setting up a dynamic site with multiple dynamically generated pages.
Here's an overview of how to set up a fallback resource and some best practices.
You can set up a fallback resource in your
httpd.conf file, or you can put it in your
.htaccess file. Either way, just add the
FallbackResource keyword followed by the path to your default file.
Some things to note:
Never use a relative path! When you use a relative path, it uses the directory the user specified in the url, not the directory specified, which can lead to an endless loop.
This may seem obvious, but remember if a file exists, the server won't use the fallback resource. So if you want to serve all pages from a fallback resource, don't include any other files in the folder.