Error: "No route was found for" GET / web / app_dev.php ""

I created the package using the php app/console generate:bundle command to add the package to /app/AppKernel.php as well as to /app/config/routing.yml . If I try to access the URL http://devserver/web/app_dev.php/bank_homepage , I get 404 error. I check /app/logs/prod.log and see the following:

[2013-07-29 13:41:27] request.ERROR: Unused PHP exception Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException: "No route found for" GET / web / app_dev.php / bank_homepage "on / var / www /html/app/cache/prod/classes.php line 1880 {"Exception": "[object] (Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException: No route found for \" GET / web / app.php / bank_homepage \ "in /var/www/html/app/cache/prod/classes.php:1880, Symfony \ Component \ Routing \ Exception \ ResourceNotFoundException: at /var/www/html/app/cache/prod/appProdUrlMatcher.php: 1222) "} []

What am I doing wrong?

This is my /app/config/routing.yml

 bank: resource: "@BankBundle/Resources/config/routing.yml" prefix: / .... 

And this is my /src/BankBundle/Resources/config/routing.yml

 bank_homepage: pattern: /hello/{name} defaults: { _controller: BankBundle:Default:index } requirements: _method: GET 

EDIT some tests I change the URL from http://devserver/web/app_dev.php/bank_homepage to http://devserver/web/app_dev.php and then the error changes to this:

[2013-07-29 14:22:15] request.ERROR: Unaccepted PHP exception Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException: "No route found for" GET / web / app_dev.php ", in / var / www /html/app/cache/prod/classes.php line 1880 {"Exception": "[object] (Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException: No route found for \" GET / web / app_dev.php \ " at /var/www/html/app/cache/prod/classes.php:1880, Symfony \ Component \ Routing \ Exception \ ResourceNotFoundException: at /var/www/html/app/cache/prod/appProdUrlMatcher.php:1222) "} []

What is almost the same

PS: I check (this) [No route found for "GET / portfolio", but this did not work for me

+4
source share
2 answers

Change your path to "bank_homepage":

 bank_homepage: path: /bank_homepage defaults: { _controller: BankBundle:Default:index } requirements: _method: GET 

Make sure you are in dev mode:

 php app/console cache:clear --env=dev 
+1
source

add another slash at the end of the picture

Example: pattern: / hello / {name} /

0
source

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


All Articles