Symfony default, catch-all route for non-existent URLs

Symfony’s routing system is pretty easy to understand, however, what happens when you need a default, catch-all route that doesn’t match any other routes?  Instead of sending a customer to a 404, you can redirect them to a default path, in this case, it’s the root path “/” (defined in the line “path: /” below) but it could be another path if you’d like.  Remember that the order of the routes are important and take precedence over ones Symfony encounters later down the routing directives list.

Visit Symfony’s documentation for more details:

Aaron Belchamber has written 247 articles

Leave a Reply

Your email address will not be published. Required fields are marked *