1
votes

I am using cakephp I need to change url for SEO. Ineed to remove controller name and use only action name my code is like this :

In view file

echo $this->Html->link('Our Partner',array('controller'=>'Homes','action'=>'partners'),array('escape'=>FALSE)); 

and in routes:

Router::connect(
    '/partners',
    array('controller' => 'homes', 'action' => 'partners')

);

But it is getting controller and action name by default how to remove that?

2

2 Answers

0
votes

Your problem is that you used Home and home :) Otherwise your code is right.

0
votes
Router::connect(
    '/:query',    array('controller' => 'Homes', 'action' => 'partners',1)
    array('query' => '[a-zA-Z]+') );

Here id is numeric with regex. please see this