<?php
namespace Engine\Mvc\Response; class HtmlRedirect extends Html { protected function initialize($url, array $headersArr) { $html = <<<HTML
<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url={%URL}">
        <script type="text/javascript">
			setTimeout(function() {
            	window.location.href = "{%URL}"
			}, 2000);
        </script>
        <title>Redirect to {%URL}</title>
    </head>
    <body>
        If you are not redirected automatically, follow <a href='{%URL}'>{%URL}</a>
    </body>
</html>
HTML;
$replacements = [ '{%URL}' => $url, ]; parent::initialize(str_replace(array_keys($replacements), array_values($replacements), $html), []); $this->headers->append("Location", $url); $this->headers->append("Cache-Control", "must-revalidate, no-store, no-cache"); } } 