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