This condition is a problem:
RewriteCond %{REQUEST_URI} !^/
You say that everything that starts with '/' is not overwritten, and everything starts with '/'. You should use $ at the end:
RewriteCond %{REQUEST_URI} !^/$
I'm not sure if you need a rule at all, because if index.html exists, the other two rules will take care of this automatically. Just use them to rewrite everything that does not physically exist:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ app/webroot/$1 [L,QSA]
And you can handle the 404 error in your application, since in any case you will need it for subdirectories.
Kelly
source share