public function createRedirect($from, $to, $permanent = false)
    {
        $route = new Route($from, function (Request $request, Response $response) use ($from, $to, $permanent) {
            // Map URL variables
            $urlVariables = VariableUrl::extractUrlVariables($request->getRequestUri(), $to);

            if (!empty($urlVariables)) {
                $to = VariableUrl::applyUrlVariables($to, $urlVariables);
            }

            // Perform redirect response
            $response->doRedirect($to, $permanent);
        });
        $this->register($route);
        return $route;
    }