<?php
  $file = $_SERVER ["REQUEST_URI"];

  if (preg_match ("#^([^\\?\\.]+)[\\?\\.]#", $file, $reg_arr))
    $file = $reg_arr [1];

  $file = str_replace ("..", "_", $file);
  $file = str_replace ("./", "", $file);
  $file = str_replace ("/", "", $file);

  if (@is_file ($file . ".html"))
  {
    header ("Location: " . $file . ".html");
    exit;
  }

//  header ("Status: 404 Not found");
?>
<!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 <?=$_SERVER ["REQUEST_URI"]?> was not found on this server.</p>
<hr>
<address>Server at jforjustice.co.uk Port 80</address>
</body></html>
