Update formatting. Update "<space><tab>" and "<tab><space>" where needed.
[lhc/web/wiklou.git] / 404.php
1 <?php
2
3 header( 'HTTP/1.1 404 Not Found' );
4 header( 'Content-Type: text/html;charset=utf-8' );
5
6 # $_SERVER['REQUEST_URI'] has two different definitions depending on PHP version
7 if ( preg_match( '!^([a-z]*://)([a-z.]*)(/.*)$!', $_SERVER['REQUEST_URI'], $matches ) ) {
8 $prot = $matches[1];
9 $serv = $matches[2];
10 $loc = $matches[3];
11 } else {
12 $prot = "http://";
13 $serv = strlen( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
14 $loc = $_SERVER["REQUEST_URI"];
15 }
16 $encUrl = htmlspecialchars( $prot . $serv . $loc );
17
18 // Looks like a typical apache2 error
19 $standard_404 = <<<ENDTEXT
20 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
21 <html><head>
22 <title>404 Not Found</title>
23 </head><body>
24 <h1>Not Found</h1>
25 <p>The requested URL $encUrl was not found on this server.</p>
26 </body></html>
27 ENDTEXT;
28
29 echo $standard_404;