I’m wondering if there is any way to run other 404 notFoundHandler or different twig template depending on route.
I have 3 routing groups:
Website - '/'
Website admin panel - '/admin’
Api - ‘/api’
I have working notFoundHandler for 404 but i want to use other notFoundHandler or render different template depending on where 404 was returned. For example:
/admin/badUrl - should run adminNotFoundHandler or at least render templates/admin/404.twig
/api/badUrl - should run apiNotFoundHandler without rendering template - just 404
/anyOtherBadUrl - should run websiteNotFoundHandler or at least render templates/website/404.twig
At this point im thinking if it would be a good idea to actually create 3 app entrypoints with .htaccess and just split each app specific classes, dependencies, settings etc. which would resolve this problem.
I have seen a workaround there: Handling multiple 404’s? but it doesn’t really feel right to change handler behaviour depending on URI path.