Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Symfony 4, conditional route redirect/override in PROD mode

$
0
0

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.


Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>