0

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.

Johann
  • 748
  • 5
  • 17
  • Did you try `./app/console --env=prod cache:clear`? If that doesn't help, what's the output of `./app/console router:debug -e=prod`? – k0pernikus Apr 14 '13 at 22:46
  • Yes I tried to clear the cache, I even cleared it manually by deleting all files in the cache/prod directory, but nothing changes. Here is what the `roter:debug` gives me for the prod: `Name Method Scheme Host Path bach_index ANY ANY ANY /index` – Johann Apr 14 '13 at 22:51

1 Answers1

1

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!

luisete89
  • 200
  • 1
  • 2
  • 11
  • Yes, it's working for routes with something after the `web/` part, like `web/contact`, but for the home page with nothing after it's not working. If I comment out the first two rules in the `.htaccess` file it works with `web/app.php/`. So there is two solutions: adding a pattern for the index route or a prefix for all routes while developing or disabling the rules `RewriteCond %{ENV:REDIRECT_STATUS} ^$` and `RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]` – Johann Apr 19 '13 at 15:12
  • 1
    @jobou I've made a test with nothing after `/web/` and It works! Verify you have well-defined routes and try to clear the cache (`console cache:clear` or delete all folders under `yourProyectRoot\app\cache`). I did that and it works fine. – luisete89 Apr 20 '13 at 10:32
  • Yes I did all this, clear the cache and check that my routes are correct. I have a route with `pattern: /` for the index page, but if I try to access `/web/` with the default .htaccess rules I end up with the error `The requested URL /Users/Johann/Sites/Bach/web/app.php was not found on this server.` (I've deleted the routes for the AcmeDemoBundle). I'm starting to think it may be a problem with my local web server and not directly with Symfony... – Johann Apr 20 '13 at 15:41