skip to Main Content

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

Answers


  1. Your problem is that you used Home and home 🙂
    Otherwise your code is right.

    Login or Signup to reply.
  2. Router::connect(
        '/:query',    array('controller' => 'Homes', 'action' => 'partners',1)
        array('query' => '[a-zA-Z]+') );
    

    Here id is numeric with regex. please see this

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search