The route of FosUserBundle '/login' must not be accessible in Production mode. It must redirect to the route '/choiceConnexion'.
I thought I had this working because in dev mode there is a redirect successfully taking place, using 'config/routes/dev/routes.yaml' in this mode. However when setting the env in prod, the redirect doesn't work.
I have tried putting similar confingurations in a config/routes/prod folder, thinking it would switch, however it doesn't work.
I assumed in Prod the first code snippet below woulc be called:
config/routes.yaml
home_choiceConnexion:
path: /login
controller: App\Controller\HomeController::choiceConnexion
The above doesn't work, however in dev, the rerouting taking place in config/dev/routes.yaml does work when the app is in dev mode.
fos_user_security_login:
path: /softia/login
controller: FOS\UserBundle\Controller\SecurityController::loginAction
The main difference is that '/login' already exists, so I think the rerouting doesn't get prioretized and doesn't override the route fos_user_security_login.
I need to achieve this redirection for a client's project and would be grateful of any help.
debug:router
for list of routes in your project – LudoAPP_ENV=prod php bin/console router:match /login
and see if the expected route is being used? – dbrumannHomeController::choiceConnexion
does an accidental redirect to the other route at some point? – dbrumann