Routing with parameters

I’m working on a CMS as a flagship project on Yii. I have a module called ‘Pages’ that is responsible for managing all of the user created pages. Each of these created pages will have a route that makes it accessible in addition to accessing it with its page id.

I can access a page with an id of 4 by requesting: ‘/pages/default/index?pid=4’

I’m trying to figure out how to create a route so that I request ‘/myroute’ and have it direct to ‘/pages/default/index?pid=4’. I don’t mean redirect - I don’t want people seeing ‘…index?pid=4’

Currently, I’m messing around in the UrlManager overriding processRules. I can easily make ‘/myroute’ direct to ‘/pages/default/index’ (ie without get parameters), but I can’t figure out how to make it work with parameters.

Thanks for any help.

Let your index action take a $pid parameter.

That’s all you need to do. :)

Thanks!