I need to be able to redirect absolutely all URLs in a directory to the index.php file in the directory. Unlike for all of the other answers I've found, this includes existing directories and existing files. I am using Apache with an .htaccess file to accomplish this. So far my .htaccess file is as follows:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule /sub/directory/index\.php - [L] RewriteRule - /sub/directory/index\.php </IfModule>
But for some reason it doesn't redirect anything to index.php. I've also tried:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule /sub/directory/index\.php - [L] RewriteRule ^.*$ /sub/directory/index\.php </IfModule>
But this gives me an inevitable "500 Error". What am I doing wrong? How can I simply redirect everything to index.php?
TIA