Hello Ketan, I'm not sure this is the best solution, but for me it works, if I define all controller actions explicitly at the beginning:
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); Router::connect('/mycontroller1/:action', array('controller' => 'mycontroller1')); Router::connect('/mycontroller2/:action', array('controller' => 'mycontroller2')); // all the others go to city Router::connect('/*:action', array('controller' => 'city')); Hope this helps! Regards, Christoph On 31 Aug., 14:24, Ketan Patel <[EMAIL PROTECTED]> wrote: > I want to create a url such as : > > http://www.domain.com/cityName -- Having issues with this as > cityname could be any city in the world. > > http://www.domain.com/cityname/ab-12323-ksowld12aca2 -- Works fine. > > when I give the cityname, it goes on looking for > 'CityNameController.php'. Now I can't go and create 100 controllers > for 100 cities. There has to be a way to do it so that I can direct > any cityname to a specific controller that takes care of all cities. > > The problem here is that if I want to assign special route for > handling the citynames as below: > > Router::connect('/([A-z]+)', array('controller'=>'city', > 'action'=>'show')); > > Now above will obviously capture all the controllers default action. > ie. > > http://www.domain.com/helphttp://www.domain.com/contact_us > > I want to capture only city names and not other controllers. Is there > a CAKE way to check if there is a valid controller then use that > controller else forward to the city controller? > > I can code up in city controller that if it is not a valid city then > do request action to the so-called controller. But I do not see this > as a very good approach. Alternate way is to modify the router.php and > check for controller's existence in there. > > Please let me know your views on how to approach this issue. > > Thanks, > Ketan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---