$snLen && substr($_SERVER['REQUEST_URI'],0,$snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) { $url = substr($_SERVER['REQUEST_URI'],$snLen+1); $url = strtok($url, '?'); $_GET['url'] = $_REQUEST['url'] = $url; $fileName = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $url; /** * This code is a very simple wrapper for sending files * Very quickly pass through references to files */ if(file_exists($fileName)) { $fileURL = dirname($_SERVER['SCRIPT_NAME']) . '/' . $url; header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently'); header("Location: $fileURL"); die(); } } // For linux $_SERVER['SCRIPT_FILENAME'] = str_replace('/index.php','/sapphire/main.php', $_SERVER['SCRIPT_FILENAME']); $_SERVER['SCRIPT_NAME'] = str_replace('/index.php','/sapphire/main.php', $_SERVER['SCRIPT_NAME']); // And for windows $_SERVER['SCRIPT_FILENAME'] = str_replace('\\index.php','\\sapphire\\main.php', $_SERVER['SCRIPT_FILENAME']); $_SERVER['SCRIPT_NAME'] = str_replace('\\index.php','\\sapphire\\main.php', $_SERVER['SCRIPT_NAME']); chdir('sapphire'); require_once('sapphire/main.php');