See http://technology.blue-bag.com/apache-rewrites-control-access-php-files
There are certain PHP files that you want access to but don't want to make public. Common examples of these are:
- PHPInfo.php
- APC.php
- memcache.php
You also don't really want to deploy these on all of your sites on a server nor have them in your git repositories for sites. A neat way of dealing with this is to use rewriting in your web server config files (e.g. Apache, NGINX, IIS etc) to do the following:
- password protect these files
- deny access to all but a limited set of IP addresses
- point all requests to these files to a default set so they don't have to be duplicated in every site.
##Blocking access to all php files other than index.php.
Note that this is specific to CMSs such as Drupal and Wordpress that pass all page requests through index.php. Also in this example I refuse access to all TXT files other than robots.txt - This saves you having to delete them from your Drupal install as is often recommended for security - this saves you having to do that everytime you update core.