okay, after a few extensive testing, at last i found solution. i'll share it here, hopefully can helps other and at the same time hoping someone can helps improve it.
in bootstrap.php, i do checking in URL, if the URL is http://www.mydomain.com or http://mydomain.com, i will load /pages/frontpage. if the URL for example, http://user1.mydomain.com, i will load /blogs/frontpage. think this apps like wordpress mu. and this is my code in bootstrap.php $url_parts = explode('.', $_SERVER['HTTP_HOST'], 3); //creates the various parts if (count($url_parts) === 2 OR $url_parts[0] === 'www' ) { // default routing for main site Configure::write('Route.default', array('controller' => 'pages', 'action' => 'frontpage')); } else { // // default routing for client's site Configure::write('Route.default', array('controller' => 'blogs', 'action' => 'frontpage')); } now, in routes.php, i change the default routing code to this: Router::connect('/', Configure::read('Route.default')); so far it works perfectly. On May 13, 8:54 am, syahzul <[email protected]> wrote: > Hi all, > > I want to change default routing based on certain criteria. For > example, my apps can be access usingwww.example.com, > user1.example.com and user2.example.com. I'm using wildcard subdomain > for this. > > Everything goes well, I just want to if we can change the default > routing based on user subdomain using AppController->beforeFilter. > > // re-route to other url > if ($is_subdomain) { > Router::connect('/', array('controller' => 'pages', 'action' => > 'subpages'));} > > // use default url > else { > Router::connect('/', array('controller' => 'pages', 'action' => > 'display')); > > } > > I try with the above code seems not working as I wish. Any ideas? > > Thank you. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
