Skip to content

Commit

Permalink
Merge pull request #103 from skeeks-cms/isRedirrectNotFoundHttpException
Browse files Browse the repository at this point in the history
New cms option isRedirectNotFoundHttpException
  • Loading branch information
skeeks-semenov committed Apr 5, 2018
2 parents a6082ca + 8535487 commit 0e19e53
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CHANGELOG

5.0.4
----------------
* New cms option isRedirrectNotFoundHttpException
* New cms option isRedirectNotFoundHttpException
* true - 404 -> 302 redirrect on main site page
* false - 404 -> render template
* Fixed create admin tree type
Expand Down
3 changes: 2 additions & 1 deletion src/actions/ErrorAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public function run()
return '';
}

if (\Yii::$app->cms->isRedirrectNotFoundHttpException && $exception instanceof NotFoundHttpException) {
if (\Yii::$app->cms->isRedirectNotFoundHttpException && $exception instanceof NotFoundHttpException) {
\Yii::$app->response->redirect(Url::home());
\Yii::$app->response->getHeaders()->setDefault('X-CMS-REDIRECT', "isRedirectNotFoundHttpException=true");
\Yii::$app->end();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Cms extends \skeeks\cms\base\Component
* Do redirects to the home page of the site in the case of 404 errors?
* @var bool
*/
public $isRedirrectNotFoundHttpException = true;
public $isRedirectNotFoundHttpException = true;

/**
* Схема временных папок
Expand Down

0 comments on commit 0e19e53

Please sign in to comment.