public function redirect($to, int $delay = 0) {
    $host = $this->server()->get('HTTP_HOST');
    
    $protocol = 'http';
    if ($this->server()->get('HTTPS')) {
      $protocol = 'https';
    }
    
    $domain = $protocol . '://' . $host;
    
    if ($delay !== 0) {
      header('Refresh: ' . $delay . '; url=' . $domain . '/' . $to);     
      return true;
    }
    
    header('Location: ' . $domain . '/' . $to);
    exit;
  }