I got the following problem. I'm trying to set-up a basic CMS in CakePHP. I've made one before by myself but I was starting to port more and more CakePHP alike functions into it so I figured I should just switch to CakePHP completely. However, I'm running into a problem with the routing. The idea is to have a PageController that handles regular page requests.
Examples: www.website.com/home/ , www.website.com/about/, etc. The above url's should actually go to: www.website.com/page/index/home/, www.website.com/page/index/about/, etc. Making index the default action for page is no problem, so this results in the following urls: www.website.com/page/home/, www.website.com/page/about/, etc. My question is as follow: How can I get rid of the /page/ controller in the URL. I need this single controller to handle the index/var/ routes because pages can be editted, deleted and added. I did find a solution that cached a list of available controllers, and then check whether /:page (using a regex) is a controller. If not it will use it as a parameter for page/index/, otherwise it will just load the correct controller. This seemed to work fine, untill I added the 'admin' prefix. Calls to /admin/page/index/ (admin_index function) are redirected to page/index/, simply because 'admin' isn't a controller. The code used is as below: Router::connect('/:page', array('controller' => 'page', 'action' => 'index'), array('pass' => array('page'), 'page' => '(?!('. $controllers.')\W+)[a-zA-Z0-9\s\/]+/?$')); $controllers is the list of cached controllers in the application. Could someone please point me in the right direction or provide a solution that handles my problem. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en