UrlManager: patterns for static pages


I have a question about urlManager. I have link in menu, defined like this:

array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about'))

So this is one of the static pages, displayed by the ‘page’ action in controller (generally good idea to have one action for any static page in controller). My question: is there a way to have url like http://mydomain.com/about for this static page? Or maybe in this case I have to move this view to separate action to make such url? The only thing that I achieved so far is to define in pattern and route, in urlManager, this way:

'about' => 'site/page'

and it makes url like: http://mydomain.com/about?view=about , but its not exacly what i want.

Thanks for any help.


'about' => array('site/page', 'defaultParams' => array('view' => 'about')),

defaultParams is available since version 1.1.3

Thanks, thats a nice feature! And released just when I need that.

If you have multiple static pages, you may consider:

'<view:(about|terms|copyright)>' => 'site/page'

This seems to work dynamicaly for all static pages. But I am not sure what it is doing.

'<view:\w+>' => 'site/page'

The regex suggests it is just matching all views. But it does not seem to mess with controllers other than static pages.