3 header( 'HTTP/1.1 404 Not Found' );
4 header( 'Content-Type: text/html;charset=utf-8' );
6 # $_SERVER['REQUEST_URI'] has two different definitions depending on PHP version
7 if ( preg_match( '!^([a-z]*://)([a-z.]*)(/.*)$!', $_SERVER['REQUEST_URI'], $matches ) ) {
13 $serv = strlen( $_SERVER['HTTP_HOST'] ) ?
$_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
14 $loc = $_SERVER["REQUEST_URI"];
16 $encUrl = htmlspecialchars( $prot . $serv . $loc );
18 // Looks like a typical apache2 error
19 $standard_404 = <<<ENDTEXT
20 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
22 <title>404 Not Found</title>
25 <p>The requested URL $encUrl was not found on this server.</p>