Search code examples
symfonylocalhostsymfony-2.2

Symfony 2.2 app.php redirects to localhost root


I'm developing Symfony2 projects on Mac OSX Mountain Lion. I started a new project with the latest 2.2.1 version. Everything works fine in the dev environment, but when I want to test the prod environment with app.php it redirects me automatically to http://localhost and displays the default page "It works!".

My other projects, that are still in version 2.1, work fine even in the prod environment. I didn't do anything different with this project, and I can't figure out how to get it working.

All my projects are in separate folders in my ~/Sites directory.


Solution

  • If you read the file UPGRADE-2.2.md, you'll find this paragraph:

    The web/.htaccess file has been enhanced substantially to prevent duplicate content with and without /app.php in the URI. It also improves functionality when using Apache aliases or when mod_rewrite is not available. So you might want to update your .htaccess file as well.

    So, if your old URI for production environment was: http://server.com/yourProyect/web/app.php/example, now will be: http://server.com/yourProyect/web/example.

    Cheers!