Controller/SEOController.php
public function robotsAction()
    {
        $response = new Response();
        $response->setSharedMaxAge( 24 * 3600 );
        $robots = [ "User-agent: *" ];

        if ( $this->get( 'kernel' )->getEnvironment() != "prod" )
        {
            $robots[] = "Disallow: /";
        }
        $rules = $this->getConfigResolver()->getParameter( 'robots_disallow', 'nova_ezseo' );
        if ( is_array( $rules ) )
        {
            foreach ( $rules as $rule )
            {
                $robots[] = "Disallow: {$rule}";
            }
        }
        $response->setContent( implode( "\n", $robots ) );
        $response->headers->set( "Content-Type", "text/plain" );
        return $response;
    }
public function robotsAction()
    {
        $response = new Response();
        $response->setSharedMaxAge( 24 * 3600 );
        $robots = [ "User-agent: *" ];

        if ( $this->get( 'kernel' )->getEnvironment() != "prod" )
        {
            $robots[] = "Disallow: /";
        }
        $rules = $this->getConfigResolver()->getParameter( 'robots_disallow', 'nova_ezseo' );
        if ( is_array( $rules ) )
        {
            foreach ( $rules as $rule )
            {
                $robots[] = "Disallow: {$rule}";
            }
        }
        $response->setContent( implode( "\n", $robots ) );
        $response->headers->set( "Content-Type", "text/plain" );
        return $response;
    }
public function robotsAction ( ) { $ response = new Response ( ) ; $ response -> setSharedMaxAge ( 24 * 3600 ) ; $ robots = [ "User-agent: *" ] ; if ( $ this -> get ( 'kernel' ) -> getEnvironment ( ) != "prod" ) { $ robots [ ] = "Disallow: /" ; } $ rules = $ this -> getConfigResolver ( ) -> getParameter ( 'robots_disallow' , 'nova_ezseo' ) ; if ( is_array ( $ rules ) ) { foreach ( $ rules as $ rule ) { $ robots [ ] = "Disallow: {$rule}" ; } } $ response -> setContent ( implode ( "\n" , $ robots ) ) ; $ response -> headers -> set ( "Content-Type" , "text/plain" ) ; return $ response ; }
Robots.txt route

@Route("/robots.txt")
@Method("GET")
@return Response
Robots . txt route