Custom 404 error page — for PHP pages only
snippet in htaccess

Custom 404 error page — for PHP pages only

user4142

<Files ~ "\.php$">
    ErrorDocument 404 /404.php
</Files>