Codice PHP:
$html_404 "http://www.sito.it/404.html";
if(
$QUERY_STRING == '404'){
Header("Location:$html_404");

Può servire?