Whenever a user demands a webpage that finishes with .php, I wish to send them a 404 error even when the page exist. Is the fact that possible related to .htaccess/mod_rewrite??

http://mysite.com/whatever.php

Haven't examined this, but it is something similar to:

RewriteRule \.php$ - [R=404]

Note: The Additional Bytes mod_rewrite cheat sheet is really a helpful resource to possess handy.

To anybody searching for the response to this on IIS, you should use the annoying "feature" in IIS where it does not return files of types that are not within the MimeMap Metabase. That's, if IIS does not understand what the file type is, it'll return a 404.

This really is documented on TechNet, together with information on how to edit the Metabase.