Symfony2 No route found for "GET /": Method Not Allowed (Allow: POST)

17,479

They have both the same name

Try this:

dm_dashboard_login:
    pattern:   /
    defaults:  { _controller: DigitalManagerERPBundle:Default:login }
    methods:  [GET]
dm_dashboard_process:
    pattern:  /
    defaults: { _controller: DigitalManagerERPBundle:Default:processLogin }
    methods:  [POST]
Share:
17,479
Kamran Ahmed
Author by

Kamran Ahmed

@kamranahmedse github.com/kamranahmedse roadmap.sh

Updated on June 04, 2022

Comments

  • Kamran Ahmed
    Kamran Ahmed almost 2 years

    I have two routes defined in in a bundle inside routing.yml and that are:

    dm_dashboard:
        pattern:   /
        defaults:  { _controller: DigitalManagerERPBundle:Default:login }
        methods:  [GET]
    dm_dashboard:
        pattern:  /
        defaults: { _controller: DigitalManagerERPBundle:Default:processLogin }
        methods:  [POST]
    

    i.e. chose the first route for GET method and chose the second for the POST method. But when I try to get that to path, I am getting this error

    No route found for "GET /": Method Not Allowed (Allow: POST)

    and none of the routes get executed. Can anyone please tell me what I'm doing wrong here? Why none of the routes executes?

    P.S Newbie here