Ashok Chandrapal
Ashok Chandrapal

Reputation: 1020

Url rewrite with action and parameters

current url is below ( yii default rule )

www.xyz.com/module/controller/action/slug-name

slug-name is one parameter that will be come from database

I need to rewrite url like below

www.xyz.com/module/controller/slug-name/action

How can I do this? Please help.

Thanks in advance.

Upvotes: 1

Views: 129

Answers (1)

hamed
hamed

Reputation: 8033

You need to add a url-manager rule like this:

'profile/admin/<slug>/test' => 'profile/admin/test'

Now, suppose I have a profile module. I have adminController controller in this module and have defined a actionTest in this controller. Signature of actionTest should be like this:

public function actionTest($slug){}

Upvotes: 2

Related Questions