As of Apache HTTPD 2.2.16 there is a new FallbackResource directive:
It is frequently desirable to have a single file or resource handle all requests to a particular directory, except those requests that correspond to an existing file or script. This is often referred to as a ‘front controller.’
In earlier versions of httpd, this effect typically required mod_rewrite, and the use of the -f and -d tests for file and directory existence. This now requires only one line of configuration.
FallbackResource /index.php
Existing files, such as images, css files, and so on, will be served normally.
This is a really useful directive to have available, reminds me of the try_files feature in Nginx.
One reply on “Apache FallbackResource Directive”
Note this nasty bug with FallbackResource: https://issues.apache.org/bugzilla/show_bug.cgi?id=52403