From 1b785495354773833b7f652a5119795a8d8998cb Mon Sep 17 00:00:00 2001 From: dozer111 Date: Fri, 10 Aug 2018 15:13:57 +0300 Subject: [PATCH] 404 на / в конце --- frontend/components/UrlManager.php | 16 +++++++++++++--- frontend/config/main.php | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frontend/components/UrlManager.php b/frontend/components/UrlManager.php index 0bd3332..a8a0481 100644 --- a/frontend/components/UrlManager.php +++ b/frontend/components/UrlManager.php @@ -70,8 +70,18 @@ public function parseRequest($request) { // $this->checkRedirect($request->url); - + $request = $this->parseLanguage($request); + $path=$request->pathInfo; + + if($path[strlen($path)-1]=='/' + # && $path[strlen($path)-2]=='/' + ) + { + throw new NotFoundHttpException(); + } + + /** * @var Alias $alias */ @@ -130,7 +140,7 @@ return $prefix . '/' . $params[ 'alias' ][ 'value' ]; } } - + return $prefix . parent::createUrl($params); } @@ -170,7 +180,7 @@ \Yii::$app->end(); } } - + return $request; } diff --git a/frontend/config/main.php b/frontend/config/main.php index 04baf36..2850f18 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -310,6 +310,7 @@ 'class' => UrlManager::className(), 'baseUrl' => '/', 'enablePrettyUrl' => true, + 'showScriptName' => false, 'rules' => [], 'hideDefaultLanguagePrefix' => true, -- libgit2 0.21.4