Default Controller for root

Well I’m still not sure what you’re trying to do. Why not simply put the routes into your config? Then you can also make use of createUrl() function instead of hardcoding the links into your page.

Or are there like 100 "root"-pages?? Then there should be a better solution. Otherwise specify every route?

There aren’t 100 pages, at the moment there are about 12 but this could grow.

What I don’t understand is why we have to put root files in the site folder and then create a rule to redirect them. I can’t believe Yii does not provide the functionality to automate this simple behaviour.

I’m not saying this will solve your particular problem but you may want to have a look at the CViewAction class. Default directory for site controller static views: ‘protected/views/site/pages’.


public function actions()


  return array(









  'showScriptName' => false,






‘yoursite/about’ will address /yoursite/staticpages/view/about

‘yoursite/about.html’ will address /yoursite/staticpages/view/about

(unfortunately the browser address field will show /yoursite/staticpages/view/about)

(will not work with a controller default action)


Thanks, but again I don’t see why rules should need to be specified in order to make it work. I can put pages in my /views/site/ folder and there is no need for any rules, I can put pages in my /views/search/ folder and again no need for any rules.