Search code examples
phpsymfonyurl-routing

Symfony2: home page displayed properly with /app_dev.php but not with /app.php


I have a home page located at /, defined in the DefaultController. It renders a Twig tempate.

When I run the application with http://localhost:8000/app_dev.php/, the home page is displayed.

When I run the application with http://localhost:8000/app.php/, I get the typical:

Welcome to Symfony 2.8.0-DEV
Your application is ready to start working on it at: /
What's next?
Read Symfony documentation to learn
...

message. How can I get app.php to display the home page?

When I browse http://localhost:8000/ I get:

The requested resource / was not found on this server.


Solution

  • You need to clear the cache to apply changes.

    $ php app/console cache:clear --env=prod
    

    Source : http://symfony.com/doc/current/cookbook/console/usage.html