htaccess 404重定向适用于除.php之外的每个扩展或路径

I have added the following line to my .htaccess file

ErrorDocument 404 /404.php

It seems to be working fine, except for any non-existent address ending with the .php extension. In that case, a message with the text "File not found." appears instead.

Any clues about what could be causing this to happen only on .php pages?

With ModRewrite On:

RewriteEngine On
RewriteBase /
ErrorDocument 404 404.php/
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ 404.php [L]