Routing question


I have just read the topic about routing. (

Still, i have two questions:

  1. I have several controllers. What i want to do is to make their web interface like pure REST. The problem is that im unsure where i should declare the routes. Should it always be in main.php or in the controller?

  2. In the topic about routing, the author wrote that, in order to declare a route, i need to do something similar to: array(‘route1’, ‘pattern’=>‘pattern1’, ‘urlSuffix’=>’.xml’, ‘caseSensitive’=>false)

but, after scrolling down, we can find this:






so, how should i declare the routes???

In main.php. Routing is already done when application instantiates the controller, so controller classes can’t declare additional routes.

Both formats are valid and will be recognized by urlManger but the second doesn’t allow you to declare multiple routes with the same pattern. Use the first format for a RESTful interface.

Many thanks for the explanation, sir. :)