'rules'=>array(
'<type:[a-z0-9\-]+>/<key:[a-z0-9\-]+>.html' => 'post/view', // other post view
'<key:[a-z0-9\-]+>.html' => array('post/view', 'defaultParams'=>array('type'=>'page')), // static page view
),
You should try it, then you will know why it doesn’t work. For ex, array(‘post/view’, ‘type’=>‘page’, ‘key’=>‘xyz’) will produce url /page/xyz.html . That’s not what I want. The problem here is that we cannot use the same route for 2 diferrent rules.
Before digging into the regex, let me ask one question: Why don’t you use a separate action to serve your static pages? They are two different things that should also be separated in your controller. That would safe you a lot of hassle.