php geek
php geek

Reputation: 219

Modify Url in cakephp and add parameter on url?

How can I remove the action name from the Url in cakephp? I tried to do it from routes.php but not getting succed my url is: http://www.example.com/liberty_new/users/home

In routes.php I have done

Router::connect('/', array('controller' => 'users', 'action' => 'home'));

I would like to remove action name from the url and like to set only the parameter in url. if I use $this->redirect(array('controller'=>'users','action'=>'home','parm1',param2));

in this redirection Url will look like

http://www.example.com/users/home/param1/param2 but I want url look like

http://www.example.com/users/param1/param2

where "users" is my controller name
please suggest me the solution

Upvotes: 0

Views: 936

Answers (2)

Adam Taylor
Adam Taylor

Reputation: 4839

Router::connect('/', array('controller' => 'users', 'action' => 'home'));
Router::connect('/users/*', array('controller' => 'users', 'action' => 'home'));

Upvotes: 1

dogmatic69
dogmatic69

Reputation: 7575

If you have

Router::connect('/', array('controller' => 'users', 'action' => 'home'));

You should go to

/

What is not working?

Upvotes: 2

Related Questions