Search code examples
phpsymfonysymfony-routing

Symfony 2.6.1 app only running in PROD enviroment


I'm developping a Symfony 2 application (version 2.6.1) but I can only run it on PROD mode. When trying to access to the following URL :

http://localhost/lawAdmin/web/app_dev.php

I'm having the next error message:

RouteNotFoundException in appDevUrlGenerator.php line 32: Unable to generate a URL for the named route "_profiler" as such route does not exist.

Both my routing.yml and routing_dev.yml files look the same:

law_admin:
    resource: "@LawAdminBundle/Controller/DefaultController.php"
    type:     annotation
    prefix:   /

Running

app/console debug:router

returns:

 [router] Current routes
 Name          Method Scheme Host Path
 porfolio_show GET    ANY    ANY  /
 gallery_show  GET    ANY    ANY  /gallery/{galleryId}

I've also tried the following command just in case unsuccessfully:

php app/console cache:clear

Solution

  • Change your routing dev to

    _wdt:
        resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
        prefix:   /_wdt
    
    _profiler:
        resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
        prefix:   /_profiler
    
    _main:
        resource: routing.yml
    

    This will load profiler and toolbar routes on dev environment, and load your own application routes from routing.yml file.