Exemplo n.º 1
0
 public function actionShow()
 {
     $request = Yii::$app->request;
     $surl = $request->get('surl');
     if (!($content = Content::findOneByURL($surl))) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     if ($content->getSURLString() !== $surl) {
         return $this->redirect(Url::toRoute(['posts/' . $content->getSURLString()]));
     }
     return $this->render('index', ['content' => $content]);
 }