I want to use mod-rewrite block execution of all files except for my bootstrap.php file in the document root, and I also want to block access to all files in the .git folder (also in the document root). Another (probably better solution) would be to allow access only files inside of a directory called public (there are multiple directories called public in different parts of my application), deny direct access to any other file while directing all other requests through my bootstrap.php file. Here's what I have.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /bootstrap.php
RewriteCond %{REQUEST_FILENAME} -fd
RewriteRule .*\.php /denied.php
RewriteCond %{REQUEST_FILENAME} -fd
RewriteRule \.git /denied.php
Any suggestions are greatly appreciated.