function safe_redirect($url, $exit=true) { // Only use the header redirection if headers are not already sent if (!headers_sent()){ header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $url); // Optional workaround for an IE bug (thanks Olav) header("Connection: close"); } // HTML/JS Fallback: // If the header redirection did not work, try to use various methods other methods print ''; print '