src/Sulu/Bundle/WebsiteBundle/Controller/RedirectController.php
public function redirectToRouteAction(Request $request, $route, $permanent = false)
    {
        if ('' === $route) {
            throw new HttpException($permanent ? 410 : 404);
        }

        $attributes = array_merge($request->attributes->get('_route_params'), $request->query->all());
        unset($attributes['route'], $attributes['permanent']);

        return new RedirectResponse(
            $this->container->get('router')->generate($route, $attributes, UrlGeneratorInterface::ABSOLUTE_URL),
            $permanent ? 301 : 302,
            ['Cache-Control' => 'private']
        );
    }
public function redirectToRouteAction(Request $request, $route, $permanent = false)
    {
        if ('' === $route) {
            throw new HttpException($permanent ? 410 : 404);
        }

        $attributes = array_merge($request->attributes->get('_route_params'), $request->query->all());
        unset($attributes['route'], $attributes['permanent']);

        return new RedirectResponse(
            $this->container->get('router')->generate($route, $attributes, UrlGeneratorInterface::ABSOLUTE_URL),
            $permanent ? 301 : 302,
            ['Cache-Control' => 'private']
        );
    }
public function redirectToRouteAction ( Request $ request , $ route , $ permanent = false ) { if ( '' === $ route ) { throw new HttpException ( $ permanent ? 410 : 404 ) ; } $ attributes = array_merge ( $ request -> attributes -> get ( '_route_params' ) , $ request -> query -> all ( ) ) ; unset ( $ attributes [ 'route' ] , $ attributes [ 'permanent' ] ) ; return new RedirectResponse ( $ this -> container -> get ( 'router' ) -> generate ( $ route , $ attributes , UrlGeneratorInterface :: ABSOLUTE_URL ) , $ permanent ? 301 : 302 , [ 'Cache-Control' => 'private' ] ) ; }
Create a redirect response which uses a route to generate redirect.

@param Request $request
@param string $route
@param bool $permanent

@return RedirectResponse
Create a redirect response which uses a route to generate redirect .