Hello readers !
Few days back I was facing issue to make public profile page in cakephp. And want to hide controller and action name from url for this I used the below code in routes.php and its work fine.
Router::connect(
'/:username', array(
'controller' => 'users', // default controller
'action' => 'profile' // default action
), array(
'pass' => array('username'), // If you want to pass the username to your action
'username' => '[a-zA-Z0-9@_\s]+' // regular expression match for the company parameter
)
);
If you are stuck with same issue try it !
0 Comment(s)