public function checkRedirect(MvcEvent $event)
    {
        if ($this->isConsoleRequest()) {
            return null;
        }

        // User defaults
        $redirectUrl = $this->redirectService->getRedirectUrl();

        if (empty($redirectUrl)) {
            return null;
        }


        $queryParams = $event->getRequest()->getQuery()->toArray();

        header(
            'Location: ' . $redirectUrl . (count($queryParams) ? '?' . http_build_query($queryParams) : null),
            true,
            302
        );
        exit;

        /* Below is the ZF2 way but Response is not short-circuiting the event like it should *
        $response = new Response();
        $response->setStatusCode(302);
        $response->getHeaders()
            ->addHeaderLine(
                'Location',
                $redirect->getRedirectUrl()
            );
        $event->stopPropagation(true);

        return $response;
        */
    }
public function checkRedirect(MvcEvent $event)
    {
        if ($this->isConsoleRequest()) {
            return null;
        }

        // User defaults
        $redirectUrl = $this->redirectService->getRedirectUrl();

        if (empty($redirectUrl)) {
            return null;
        }


        $queryParams = $event->getRequest()->getQuery()->toArray();

        header(
            'Location: ' . $redirectUrl . (count($queryParams) ? '?' . http_build_query($queryParams) : null),
            true,
            302
        );
        exit;

        /* Below is the ZF2 way but Response is not short-circuiting the event like it should *
        $response = new Response();
        $response->setStatusCode(302);
        $response->getHeaders()
            ->addHeaderLine(
                'Location',
                $redirect->getRedirectUrl()
            );
        $event->stopPropagation(true);

        return $response;
        */
    }
public function checkRedirect ( MvcEvent $ event ) { if ( $ this -> isConsoleRequest ( ) ) { return null ; } // User defaults $ redirectUrl = $ this -> redirectService -> getRedirectUrl ( ) ; if ( empty ( $ redirectUrl ) ) { return null ; } $ queryParams = $ event -> getRequest ( ) -> getQuery ( ) -> toArray ( ) ; header ( 'Location: ' . $ redirectUrl . ( count ( $ queryParams ) ? '?' . http_build_query ( $ queryParams ) : null ) , true , 302 ) ; exit ; /* Below is the ZF2 way but Response is not short-circuiting the event like it should *
        $response = new Response();
        $response->setStatusCode(302);
        $response->getHeaders()
            ->addHeaderLine(
                'Location',
                $redirect->getRedirectUrl()
            );
        $event->stopPropagation(true);

        return $response;
        */ }
Check the defined redirects.  If requested URL is found, redirect to the
new location.

@param MvcEvent $event Zend MVC Event

@return null|Response
Check the defined redirects . If requested URL is found redirect to the new location .