salve a tutti,
nell' http.conf ho creato un VirtualHost 123.0.0.3 chiamato zendf.
codice:
<VirtualHost 127.0.0.3:80>
ServerName zendf
DocumentRoot "C:/Programmi/Apache Software Foundation/Apache2.2/htdocs/ecc1/htdocs"
<Directory "C:/Programmi/Apache Software Foundation/Apache2.2/htdocs/ecc1/htdocs">
AllowOverride None
Options All
Order allow,deny
Allow from all
</Directory>
ErrorDocument 404 http://zendf/error.php
php_value include_path ".;C:/Programmi/Apache Software Foundation/Apache2.2/htdocs/ecc1/include.;C:/php/PEAR"
php_value magic_quotes_gpc off
php_value register_globals off
</VirtualHost>
Qualora la pagina immessa nell'URL non fosse trovata, si viene spediti (cosa che avviene correttamente) alla error.php (questo prova che l'errore viene riconosciuto dal browser). Nella error.php sono previste più tipologie di errore:
codice:
$error_no = $_SERVER['QUERY_STRING'];
switch ($error_no) {
case 400:
$error_output = "<h3>Errore 400 Error Page - </h3>";
$error_output .= "<a href=\"mailto:sysadmin@qualcosa.com\">" .
"Contact</a> the system administrator";
break;
case 401:
$error_output = "<h3>Errore 401 Error Page - </h3>";
break;
case 402:
$error_output = "<h3>Accesso negato. Errore 402 Error Page - </h3>";
break;
case 403:
$error_output = "<h3>Accesso negato. Errore 403 Error Page - </h3>";
break;
case 404:
$error_output = "<h3>"Pagina non trovata" Error Page - " .
"(Codice di errore 404)</h3>";
$error_output .= "La pagina cercata non può essere trovata
";
$error_output .= "<a href=\"mailto:sysadmin@qualcosa.com\">" .
"Contact: Avvisare l'amministratore del sistema</a>";
break;
case 500:
$error_output = "<h3>Errore interno al server. Errore 500 - </h3>";
break;
default:
$error_output = "<h3>Pagina con errore " . $error_no . "</h3>";
$error_output .= "Questo è un errore generico
";
$error_output .= "Per tornare alla indice cliccare <a href=\"index.php\">here</a>";
}
Il problema è che la variabile $error_no = $_SERVER['QUERY_STRING']; è vuota, come risulta
anche dal var_dump($error_no) e stampa sempre e solo il caso default.
Suggerimenti?
grazie