Vorrei modificare la mia attuale pagina che restituisce errori nel caso in cui qualcuno finisca in link e pagine inesistenti.
Il problema di questa è che spesso e volentieri trovo in Strumenti per i Webmaster di Google link inesistenti contenenti per esempio /fmp/fmp nel link anzichè /fmp, cioè la cartella in cui ho tutte le pagine del sito sul mio server. Queste pagine infatti vengono caricate senza css e layout; non so come Google se le generi, fatto sta che le trovo tra gli errori.

Questa è la pagina attuale con lo script che forse ho scaricato da qui...Non ricordo.
codice:
<?PHPob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="it" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Full Metal Panic Italy</title>
<link rel="stylesheet" type="text/css" href="../inc/style.css" />
<meta name="keywords" content="full, metal, panic, fmp, fumoffu, the second raid, spoiler, mithril, amalgam, sigma" />
<meta name="description" content="Full Metal Panic Italy, sito ufficiale italiano di Full Metal Panic con spoiler, informazioni, curiosità e molto altro! Fanart, immagini, download e schede tecniche" />
<meta name="copyright" content="Copyright fullmetalpanic-italy.com - All Right Reserved" /> 
    <link rel="shortcut icon" href="../img/favicon.ico" />
<style type="text/css">


body {
                background-color: #36502B;
}
.style1 {
                background-image: url('../img/new/images/fmp_24.jpg');
}
.style2 {
                background-image: url('../img/new/images/fmp_25.jpg');
}
.style3 {
                background-image: url('../img/new/images/fmp_21.jpg');
}
.style4 {
                text-align: center;
}
.style5 {
                background-image: url('../img/new/images/fmp_27.jpg');
}
.style6 {
                background-color: #57714B;
}
</style>


<script type="text/javascript">


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-9457424-3']);
  _gaq.push(['_trackPageview']);


  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


</script>


</head>


<body>


                                <?PHP
                                    include("../inc/menu/top.php");
                                ?>
                                </table>


                                <table style="width: 900px" cellspacing="0" cellpadding="0" align="center">
                <tr>
                                <td>
                                <img src="../img/new/images/fmp_16.jpg" width="301" height="62" alt="" /></td>
                                <td>
                                <img src="../img/new/images/fmp_17.jpg" width="18" height="62" alt="" /></td>
                                <td><img src="../img/new/images/content.jpg" width="581" height="62" alt="" /></td>
                </tr>




                                <?PHP
                                    include("../inc/menu/uscite.php");
                                ?>


                                <?PHP
                                    include("../inc/menu/storia.php");
                                ?>


                                <?PHP
                                    include("../inc/menu/spoiler.php");
                                ?>
                                <?PHP
                                    include("../inc/menu/gallery.php");
                                ?>


                                <?PHP
                                    include("../inc/menu/interviste.php");
                                ?>


                                <?PHP
                                    include("../inc/menu/other.php");
                                ?>
                                
                                <?PHP


                                    include("../inc/menu/multimedia.php");
                                ?>


                                <?PHP
                                    include("../inc/menu/affiliati.php");
                                ?>


                                <br />
                                <br />
                                </td>
                                <td valign="top" class="style6">
                                <img src="../img/new/images/fmp_22.jpg" width="18" height="293" alt="" /></td>
                                <td valign="top" class="style2">
                            
                                
                                <?PHP
                                    include("../inc/adsense1.php");
                                ?>
                                
<div class="centro-box">        
<h1>Errore</h1>                    
<?php


#Notifica di errore al webmaster.
$notifica="shika93@fullmetalpanic-italy.com". preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));


#Nome del tuo dominio
$nomesito="Full Metal Panic Italy";


#Link cliccabile per tornare alla home od ad una pagina a scelta.
$ritornahome="http://www.fullmetalpanic-italy.com/";


# Percorso file errori, permessi da settare a 777
$logerrori = "log/errore.txt";




# percorso immagini da mostrare a seconda degli errori (in questo caso sono tutte uguali)
$immagine = array (
         '000' => '/errore/denied.png',
         '400' => '/errore/denied.png',
         '401' => '/errore/denied.png',
         '403' => '/errore/denied.png',
         '404' => '/errore/denied.png',
         '500' => '/errore/denied.png'
         );




#Oggetto della mail di notifica: e' anche il titolo della pagina corrispondente.
$subject = array ( 
         '000' => 'Errore sconosciuto',
         '400' => 'Errore 400',
         '401' => 'Non sei autorizzato',
         '403' => 'Errore 403',
         '404' => 'File non trovato',
         '500' => 'Errore di configurazione'
         );


# N = nessun avviso  Y = avvisami in caso di errore.
$email = array (
        '000' => 'Y',
        '400' => 'Y',
        '401' => 'Y',
        '403' => 'Y',
        '404' => 'Y',
        '500' => 'Y'
        );


# N per non scrivere log Y per scrivere
$log = array (
        '000' => 'Y',
        '400' => 'Y',
        '401' => 'Y',
        '403' => 'Y',
        '404' => 'Y',
        '500' => 'Y'
        );


###################################################################
#
# messaggi di errore.
#
#Pagina che appare con errore 400
$msg['400'] = "
<p><b>Bad Request (400)<br /><br />L'indrizzo che hai richiesto, $REDIRECT_URL
non e' un indirizzo valido.</b><br /><br />
<b>The request had bad syntax or was impossible to be satisified.</b></p>";


################################################################## 
#HPagina che appare con errore 401
$msg['401'] = "
<p><b>Unauthorized (401)<br /><br />L'indrizzo che hai richiesto, $REDIRECT_URL
necessita di autorizzazione.</b><br /><br />
<b>User failed to provide a valid user name / password required for access to file / directory.</b></p>";


################################################################## 
#Pagina che appare con errore 403
$msg['403'] = " 
<p><b>Forbidden(403)<br /><br />L'accesso all'indirizzo richiesto , $REDIRECT_URL,
e' proibito.</b><br /><br />
<b>The request does not specify the file name. Or the directory or the file does not have the permission that allows the pages to be viewed from the web.</b></p>";


################################################################## 
#Pagina che appare con errore 404
$msg['404'] = "
<p><b>Not Found(404)<br /><br />L'indirizzo richiesto non è disponibile sul server, $REDIRECT_URL.
La pagina probabilmente è stata cancellata o non è più disponibile 
<br /><br />
The requested file was not found.</b></p>";


################################################################## 
#HTML Pagina che appare con errore
$msg['500'] = " 
<p><b>Server Error (500)<br /><br />L'indirizzo richiesto, $REDIRECT_URL
restituisce errori di configurazione. 
<br /><br />
Server Error</b></p>";


################################################################## 
#Pagina che appare con errore sconosciuto
$msg['000'] = "
<p><b>L'indirizzo richiesto, $REDIRECT_URL
restituisce un errore sconosciuto.
<br /><br />
Unknown error</p></b>";




$result = $QUERY_STRING;
if ($result != "400" && $result != "400" && $result != "403" && $result != "404" && $result != "500") $result="000";


print_header($result);
echo $msg[$result];
print_footer();


if ($log[$result] == "Y") notifica("L",$result);
if ($email[$result] == "Y") notifica("M",$result);


function notifica ($action, $result)
{
  global $logerrori, $subject, $notifica, $nomesito, $REQUEST_URI, $REMOTE_ADDR, $HTTP_USER_AGENT, $REDIRECT_ERROR_NOTES, $SERVER_NAME,$HTTP_REFERER;
  $date=date("D j M G:i:s T Y");
 
  if ($action == "L") { 
    $message = "[$date] [client: $REMOTE_ADDR ($HTTP_USER_AGENT)] $REDIRECT_ERROR_NOTES\n";
    $fp = fopen ($logerrori,"a+");
    fwrite($fp, $message);
    fclose($fp);
  } else {
    
        $message = " 
------------------------------------------------------------------------------
Sito:\t\t$nomesito ($SERVER_NAME)
Codice Errore:\t$result $subject[$result] ($REDIRECT_ERROR_NOTES)
Accaduto il:\t$date
URL in errore:\t$REQUEST_URI
Indirizzo IP del browser:\t$REMOTE_ADDR
Browser:\t$HTTP_USER_AGENT
Pagina di provenienza:\t$HTTP_REFERER
------------------------------------------------------------------------------";
    mail("$notifica", "[ Errore del server: $subject[$result] ]", $message,
      "From: gestione_errori@$SERVER_NAME\r\n"
      ."X-Mailer: PHP/" . phpversion());
  }
}


function print_header($result) 
{
  global $subject, $pagina_bg_colore, $tabella_bg_colore, $tabella_testo_colore, $cella_sinistra_colore, $immagine, $colore_titoletto, $nomesito, $REDIRECT_ERROR_NOTES;
    $error_notes = preg_replace("/:.*/","",$REDIRECT_ERROR_NOTES);
  if (empty($error_notes)) $error_notes = "Unknown";
  echo "
  
  <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
    <tr>
      <td valign=\"middle\">
        <table width=\"550\" border=\"0\" align=\"center\" cellspacing=\"0\" cellpadding=\"5\">
          <tr>
            <td>
              <img src=\"$immagine[$result]\" alt=\"error\" title=\"Accesso Negato\" height=\"150\" width=\"116\" />
            </td>
            <td>
                <span style=\"font-weight: 600; color: $colore_titoletto;\">$nomesito</span> <b>Errore $result</b>
                <br />
                ($error_notes)
              <br />";
}


function print_footer()
{
  global $ritornahome;
  echo "
              <br />
              <br />
              <center> <a href=\"$ritornahome\">Clicca qui</a> per tornare alla nostra HomePage</center>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>";
}


?>




</div>
                                <?PHP
                                    include("../inc/adsense2.php");
                                ?>
</td>
                </tr>
</table>


<table style="width: 900px" cellspacing="0" cellpadding="0" align="center">
                <tr>
                    <td><img src="../img/new/images/footer.jpg" width="900" height="178" alt="" /></td>
                </tr>
</table>


</body>


</html>
Sapete dirmi dove trovarne una migliore o un semplice script collegato al file .htaccess che generi la pagina di errore e che blocchi pure le eventuali che google si genera?