How to setup default routing in Symfony2?
In Symfony1 it looked something like this:
homepage:
url: /
param: { module: default, action: index }
default_symfony:
url: /symfony/:action/...
param: { module: default }
default_index:
url: /:module
param: { action: index }
default:
url: /:module/:action/...
Create a default route is not a good way of programming. Why? Because for this reason was implemented Exception. Symfony2 is built just to do right things in the right way.
If you want to redirect all "not found" routes you should use exception, like NotFound404 or something similar. You can even customise this page at your own.
One route is for one purpose. Always. Other think is bad.
You could create your own bundle that handled all requests and used URL parameters to construct a string to pass to the controller's forward method. But that's pretty crappy, I'd go with well defined routes, it keeps your URLs cleaner, and decouples the URL and controller names. If you rename a bundle or something, do you then have to refactor your URLs?
I don't think it's possible with the standard routing component. Take a look to this bundle, it might help : https://github.com/hidenorigoto/DefaultRouteBundle
// Symfony2 PR10
in routing.yml:
It enables you to use this kind of urls: http://localhost/MySuperBundle:MyController:myview