Symfony 2 routes not found in production

I have routes like: /, / login, / register, etc. that work fine in the dev environment.

First I got a 404 error when trying to access my site through app.php instead of app_dev.php

Then I followed this advice and cleared the cache.

But now I get a blank screen, trying to access any of the registered routes, such as app.php / or app.php / login.

I found this post in prod.log:

[2012-02-24 11:27:05] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /login" (uncaught exception) at /home/renat/www/ptracker/app/cache/prod/classes.php line 4564 [] [] 

Here is my routing.yml:

 PtrackerTasksBundle: resource: "@PtrackerTasksBundle/Resources/config/routing.yml" prefix: / PtrackerAuthBundle: resource: "@PtrackerAuthBundle/Resources/config/routing.yml" prefix: / 

routing.yml in AuthBundle:

 homepage: pattern: / defaults: { _controller: PtrackerAuthBundle:Default:index } register: pattern: /register defaults: { _controller: PtrackerAuthBundle:Default:register } login: pattern: /login defaults: { _controller: PtrackerAuthBundle:Default:login } activate: pattern: /activate/{username}/{salt} defaults: { _controller: PtrackerAuthBundle:Default:activate } login_check: pattern: /login_check 

routing.yml in TasksBundle:

 tasks: pattern: /tasks defaults: { _controller: PtrackerTasksBundle:Default:index } tasks_add: pattern: /tasks/add defaults: { _controller: PtrackerTasksBundle:Default:add } tasks_view: pattern: /tasks/view/{id} defaults: { _controller: PtrackerTasksBundle:Default:view, id : null } tasks_change_responsible: pattern: /tasks/change_responsible/{id}/{responsible} defaults: { _controller: PtrackerTasksBundle:Default:change_responsible, _format: json } tasks_change_status: pattern: /tasks/change_status/{id}/{status} defaults: { _controller: PtrackerTasksBundle:Default:change_status, _format: json } tasks_edit: pattern: /tasks/edit/{id} defaults: { _controller: PtrackerTasksBundle:Default:edit } 

What am I missing or what am I doing wrong?

+6
source share
3 answers

First look at the list of route consoles ( router:debug command). If you found your routers, then in my case, some problems with the clearing cache, I delete the app/cache folder manually, and it works.

To install the PROD environment without a cache in the app.php file app.php change to

 $kernel = new AppKernel('prod', true); 
+10
source

Try clearing the cache for the prod environment.

 php app/console cache:clear --env=prod --no-debug 
+7
source
 app/console cache:clear or active mod_rewrite in activate the directory: nano /etc/apache2/apache2.conf AllowOverride None <Directory "/var/www/html"> AllowOverride None </Directory> for <Directory "/var/www/html"> AllowOverride All </Directory> http://www.dev-metal.com/enable-mod_rewrite-ubuntu-14-04-lts/ 
0
source

Source: https://habr.com/ru/post/909259/


All Articles