'.$_SERVER['REQUEST_URI']; $uri = $_SERVER['REQUEST_URI']; if (ereg('\?', $uri)) { $parts = explode('/', $uri); $query = array_pop($parts); $redirect = implode('/', $parts) . '/' . urlencode($query) . '.html'; } else if (ereg('(\.[a-z]{3,4}\.html)$', $uri)) { $redirect = ereg_replace('(\.html)$', '', $uri); } else { $redirect = 'index.php.html'; } //file_put_contents('index.php.log', $redirect.' -- '.$uri."\n", FILE_APPEND); header( "HTTP/1.1 301 Moved Permanently" ); //echo '
'.$redirect; header('Location: '.$redirect); ?>