Routing in CakePHP to vanity urls
问题 I was wondering if there was an easy and best practices way to make routes in CakePHP (routes.php file) to map userIDs to a vanity url? I have (terrible way to do this) the following test code in my routes page: $users = array ( 1 => 'firstname-lastname', 2 => 'firstname2-lastname2' ); //profiles foreach($users as $k => $v) { // LESSONS (Profiles) Router::connect('/:user', array('controller' => 'teachers', 'action' => 'contentProfile', $k), array('user' => '(?i:'.$v.')')); } The above code