Hello,
I am following http://www.joshuawinn.com/yii-clean-seo-friendly-urls-for-pages/
I cannot get this working, my pages hang.
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
'rules'=>array(
//'pages/view/<slug:[a-zA-Z0-9-]+>/'=>'pages/view',
'<controller:w+>/<id:d+>'=>'<controller>/view',
'<controller:w+>/<action:w+>/<id:d+>'=>'<controller>/<action>',
'<controller:w+>/<action:w+>'=>'<controller>/<action>',
'<view:[a-zA-Z0-9-]+>/'=>'site/page',
),
CHtml::link($row->title,array('pages/view','slug'=>$row->slug))
public function actionShow($slug)
{
$this->render('show', array('model'=>$this->loadModelSlug($slug),);
}
public function loadModelSlug($slug)
{
$model = Pages::model()->Active()->findByAttributes(array('slug'=>$slug));
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Thanks for the help