If you’re like me, then you are useless at remembering a couple of things which tend to start a project. I recently found the “FallbackResource” command in Apache.
This single command replaces the mod_rewrite rules:
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
with the single command
FallbackResource /index.php
I can remember that one! It basically does the same thing – If the file does not exist (any file, such as css/images/PHP scripts) then it will route it to index.php.
For the
FallbackResource
you have forgotten to include the location of index.phpFor it to work correctly, you need to set the uri location (from the domain root) to the fallback resource. For example if the index.php is in the root of the domain, then the code should be as follows:
FallbackResource /index.php
ref: http://httpd.apache.org/docs/2.2/mod/mod_dir.html#fallbackresource
Looks like you are correct 🙂 Edited, thanks!