Rohit
Rohit

Reputation: 401

Cakephp rewrite rule

I have url Microsites/index. With action index I want to pass parameter like 1001.So, crated rule for it as given below:

Router::redirect('/Microsites', array('controller' => 'Microsites', 'action' => 'index',1001));

It working fine & shows url in addressbar like: /Microsites/index/101

But, I want to show url like : /Microsites/index

Most welcome for suggestions....

Upvotes: 0

Views: 158

Answers (1)

floriank
floriank

Reputation: 25698

How do you build your link? The array you pass to the Html::link method must be the array you declared in your route so that it matches and the router genrates the correct URL string based on the give array data.

$this->Html->link('Microsites', array('controller' => 'Microsites', 'action' => 'index',1001));

Should do it.

Upvotes: 1

Related Questions