Add an extra RewriteCond condition in the ruleset that internally rewrites. This will test that REQUEST_URI is NOT ^/customerrors/
Isn't it too late then? A custom 404 page can only be (internally) requested if the server has previously returned a 404, and the all-purpose
RewriteRule . /index.php [L]
prevents that from happening in the first place. Besides, the error page does exist, so no rewrite would happen.
You can do one or the other-- use a custom error page OR send everything to index.php-- but it's hard to do both.
And what if someone requests a nonexistent image? Shouldn't the boilerplate at least be constrained to php and/or no extension? (Yes, I realize that isn't specific to the current question. It's built in. But it still seems like overkill.)