module/Core/src/Grid/Core/Controller/IndexController.php
public function contentUriAction()
    {
        $actual = $this->getSubDomainModel()
                       ->findActual();

        if ( empty( $actual ) )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        $uri = $this->params()
                    ->fromRoute( 'uri' );

        // prevent "Invalid Encoding Attack"
        if ( ! mb_check_encoding( $uri, 'UTF-8' ) )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        $structure = $this->getUriModel()
                          ->findBySubdomainUri( $actual->id, $uri );

        if ( empty( $structure ) )
        {
            $this->paragraphLayout();

            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        if ( ! $structure->default )
        {
            $default = $this->getUriModel()
                            ->findDefaultByContentSubdomain(
                                $structure->contentId,
                                $actual->id,
                                $structure->locale
                            );

            if ( $default->uri != $structure->uri ) // Avoid infinite redirect circles
            {
                $response = $this->getResponse();

                $response->getHeaders()
                         ->addHeaderLine( 'Location',
                                          '/' . $default->safeUri );

                // Permanent redirect: for "old" uris
                return $response->setStatusCode( 301 );
            }
        }

        if ( ! empty( $structure->locale ) )
        {
            $this->getServiceLocator()
                 ->get( 'Locale' )
                 ->setCurrent( $structure->locale );
        }

        return $this->forward()
                    ->dispatch( 'Grid\Paragraph\Controller\Render', array(
                        'controller'    => 'Grid\Paragraph\Controller\Render',
                        'action'        => 'paragraph',
                        'locale'        => (string) $this->locale(),
                        'paragraphId'   => $structure->contentId
                    ) );
    }
public function contentUriAction()
    {
        $actual = $this->getSubDomainModel()
                       ->findActual();

        if ( empty( $actual ) )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        $uri = $this->params()
                    ->fromRoute( 'uri' );

        // prevent "Invalid Encoding Attack"
        if ( ! mb_check_encoding( $uri, 'UTF-8' ) )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        $structure = $this->getUriModel()
                          ->findBySubdomainUri( $actual->id, $uri );

        if ( empty( $structure ) )
        {
            $this->paragraphLayout();

            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        if ( ! $structure->default )
        {
            $default = $this->getUriModel()
                            ->findDefaultByContentSubdomain(
                                $structure->contentId,
                                $actual->id,
                                $structure->locale
                            );

            if ( $default->uri != $structure->uri ) // Avoid infinite redirect circles
            {
                $response = $this->getResponse();

                $response->getHeaders()
                         ->addHeaderLine( 'Location',
                                          '/' . $default->safeUri );

                // Permanent redirect: for "old" uris
                return $response->setStatusCode( 301 );
            }
        }

        if ( ! empty( $structure->locale ) )
        {
            $this->getServiceLocator()
                 ->get( 'Locale' )
                 ->setCurrent( $structure->locale );
        }

        return $this->forward()
                    ->dispatch( 'Grid\Paragraph\Controller\Render', array(
                        'controller'    => 'Grid\Paragraph\Controller\Render',
                        'action'        => 'paragraph',
                        'locale'        => (string) $this->locale(),
                        'paragraphId'   => $structure->contentId
                    ) );
    }
public function contentUriAction ( ) { $ actual = $ this -> getSubDomainModel ( ) -> findActual ( ) ; if ( empty ( $ actual ) ) { $ this -> getResponse ( ) -> setStatusCode ( 404 ) ; return ; } $ uri = $ this -> params ( ) -> fromRoute ( 'uri' ) ; // prevent "Invalid Encoding Attack" if ( ! mb_check_encoding ( $ uri , 'UTF-8' ) ) { $ this -> getResponse ( ) -> setStatusCode ( 404 ) ; return ; } $ structure = $ this -> getUriModel ( ) -> findBySubdomainUri ( $ actual -> id , $ uri ) ; if ( empty ( $ structure ) ) { $ this -> paragraphLayout ( ) ; $ this -> getResponse ( ) -> setStatusCode ( 404 ) ; return ; } if ( ! $ structure -> default ) { $ default = $ this -> getUriModel ( ) -> findDefaultByContentSubdomain ( $ structure -> contentId , $ actual -> id , $ structure -> locale ) ; if ( $ default -> uri != $ structure -> uri ) // Avoid infinite redirect circles { $ response = $ this -> getResponse ( ) ; $ response -> getHeaders ( ) -> addHeaderLine ( 'Location' , '/' . $ default -> safeUri ) ; // Permanent redirect: for "old" uris return $ response -> setStatusCode ( 301 ) ; } } if ( ! empty ( $ structure -> locale ) ) { $ this -> getServiceLocator ( ) -> get ( 'Locale' ) -> setCurrent ( $ structure -> locale ) ; } return $ this -> forward ( ) -> dispatch ( 'Grid\Paragraph\Controller\Render' , array ( 'controller' => 'Grid\Paragraph\Controller\Render' , 'action' => 'paragraph' , 'locale' => ( string ) $ this -> locale ( ) , 'paragraphId' => $ structure -> contentId ) ) ; }
Content-uri action
Content - uri action