getConfig()['redirect']['path'] ?? ''; if ( $path === '' ) { throw new RouteDefinitionException( 'No registered redirect for this path' ); } $code = $this->getConfig()['redirect']['code'] ?? 308; $pathParams = $this->getRequest()->getPathParams(); $queryParams = $this->getRequest()->getQueryParams(); $locationPath = $this->getRouter()->getRoutePath( $path, $pathParams, $queryParams ); $response = $this->getResponseFactory()->createRedirect( $locationPath, $code ); return $response; } }