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]