public function onKernelRequestRedirect(GetResponseEvent $event)
    {
        if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
            $request = $event->getRequest();
            if ($request->attributes->get('needsRedirect') && $request->attributes->has('semanticPathinfo')) {
                $siteaccess = $request->attributes->get('siteaccess');
                $semanticPathinfo = $request->attributes->get('semanticPathinfo');
                $queryString = $request->getQueryString();
                if (
                    $request->attributes->get('prependSiteaccessOnRedirect', true)
                    && $siteaccess instanceof SiteAccess
                    && $siteaccess->matcher instanceof URILexer
                ) {
                    $semanticPathinfo = $siteaccess->matcher->analyseLink($semanticPathinfo);
                }

                $headers = [];
                if ($request->attributes->has('locationId')) {
                    $headers['X-Location-Id'] = $request->attributes->get('locationId');
                }
                $event->setResponse(
                    new RedirectResponse(
                        $semanticPathinfo . ($queryString ? "?$queryString" : ''),
                        301,
                        $headers
                    )
                );
                $event->stopPropagation();

                if (isset($this->logger)) {
                    $this->logger->info(
                        "URLAlias made request to be redirected to $semanticPathinfo",
                        array('pathinfo' => $request->getPathInfo())
                    );
                }
            }
        }
    }