RewriteCond check if directory exists with an index file
You need to check for the directory part:
RewriteCond %{REQUEST_FILENAME}/index\.php !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ redirect.php [QSA,L]
Also:
The funny thing I also found is that if I had a .htaccess in that folder with RewriteEngine on (just that), then the rewrite rule above works...
This is because rewrite rules in subdirectories have precedence over any rules in parent directories. So if you have a subdirectory with RewriteEngine On
, with no rules, then that means that subdirectory has precedence over rewrite rules in the parent directory and there are no rules. (a bit confusing).
Try this rule in your root .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1/index.php !-f
RewriteRule ^(.*?)/?$ redirect.php [L]