简体   繁体   中英

Symfony2 routing no match

We have a symfony2 application. Everything was successful until we tried to create a subdomain (for a different application). For our first test with the subdomain we linked the subdomain to a route in the s2 application.

After our test the application always return a 404 code for the route used in the previous test. We return back all configurations within the server and the problem keeps.

The route is "/usuario/iniciar-sesion".

Our original configuration for the routing is:

#/src/AppBundle/Resources/routing.yml
app_user:
    resource: routing/user.yml
    prefix: /usuario

#/src/AppBundle/Resources/routing.yml
app_login:
    path: /iniciar-sesion
    defaults: { _controller: AppBundle:User:login }

We execute the next commands in console to check the routing:

php console router:debug
php console router:match /usuario/iniciar-sesion

and everything looks fine.

Everything else works fine. At this moment the hotfix is changing the prefix (we called "usuarios") and the application runs successful. After it we tried return back the original prefix, but the application keeps return the 404 code.

We execute a lot of cache:clear --env=prod and manually delete cache dir. In our local enviroment everything works fine.

What else we can check?

So as you said in the comment I think you are trying to achieve this:

#/src/AppBundle/Resources/routing.yml
app_login:
    host: usuario.site.com
    path: /iniciar-sesion
    defaults: { _controller: AppBundle:User:login }

And in the server host configuration you need to add the subdomain as a ServerAlias and also own that subdomain I think: https://www.godaddy.com/help/add-a-subdomain-that-points-to-a-server-name-19974

We resolved the problem.

We didn't consider the folders created by the server when set up the domain. We deleted them and the application responds on the original path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM