Search code examples
symfonysymfony-routing

Symfony 3 redirect all routes except with specific prefix


I'am trying to build an application using symfony and angular 2 and I was wondering if it is possible to redirect all routes to one specific action exept uri's that start with the /api prefix.

thanks in advance.


Solution

  • Yes you can take a look to 'kernel.controller' event here

    This event is triggered when the controller has been choosed but before executing it. So you can execute another one if route does'nt start with '/api' ...