<?php
$host = $_SERVER['HTTP_HOST'];
$uri  = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$uri = substr($uri, 0, strlen($uri) - 5);
$extra = "id.php?";
$extra .= $_SERVER['QUERY_STRING'];
$url = $host."/".$uri.$extra;
header( "HTTP/1.1 301 Moved Permanently" ); 
header("Location: http://$url"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>