This is for any who still have issues with static pages in subdirectories.
First, go to your controller actions & add an action to render static pages from subdirectory, like illustrated below.
public function actions()
{
return array(
// page action renders "static" pages stored under 'protected/views/site/pages'
// They can be accessed via: index.php?r=site/page&view=FileName
'page'=>array(
'class'=>'CViewAction',
),
'directory1'=>array(
'class'=>'CViewAction',
'basePath' => 'pages/directory1'
),
'directory2'=>array(
'class'=>'CViewAction',
'basePath' => 'pages/directory2'
),
);
}
Then head over to views/site/pages & create the two directories under the pages folder
eg /views/site/pages/directory1 …
create you scripts & places them here. You can create you urls like so
array('label'=>'Page Title', 'url'=>array('/site/directory1', 'view'=>'file-name-of-static-page')),
For URL Rules you do something like this
'urlManager'=>array(
'urlFormat'=>'path',
'appendParams'=>true,
'rules'=>array(
'/'=>'site/index',
'<view:[\w\-]+>'=>'site/page',
'/directory1/<view:[\w\-]+>'=>'site/directory1',
'/directory2/<view:[\w\-]+>'=>'site/directory2',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
'showScriptName' => FALSE,
'caseSensitive'=>false,
),
in the end you will have the following link -
http://www.example.com/directory1/static-page-name