public function redirect($url, $statusCode = 302, $isSecure = false) { if (substr($url, 0, 1) === '/') { $httpHost = Lune::env('HTTP_HOST'); $url = ($isSecure ? 'https://' : 'http://') . $httpHost . $url; } while (ob_get_level() > 0) { ob_end_clean(); } $this->status($statusCode); $this->header('Location', $url); $this->output('<html><head><meta http-equiv="refresh" content="0;' . 'url=' . htmlentities($url, ENT_QUOTES) . '"></head></html>'); }