Commit 1b785495354773833b7f652a5119795a8d8998cb
1 parent
abe4455d
404 на / в конце
Showing
2 changed files
with
14 additions
and
3 deletions
Show diff stats
frontend/components/UrlManager.php
@@ -70,8 +70,18 @@ | @@ -70,8 +70,18 @@ | ||
70 | public function parseRequest($request) | 70 | public function parseRequest($request) |
71 | { | 71 | { |
72 | // $this->checkRedirect($request->url); | 72 | // $this->checkRedirect($request->url); |
73 | - | 73 | + |
74 | $request = $this->parseLanguage($request); | 74 | $request = $this->parseLanguage($request); |
75 | + $path=$request->pathInfo; | ||
76 | + | ||
77 | + if($path[strlen($path)-1]=='/' | ||
78 | + # && $path[strlen($path)-2]=='/' | ||
79 | + ) | ||
80 | + { | ||
81 | + throw new NotFoundHttpException(); | ||
82 | + } | ||
83 | + | ||
84 | + | ||
75 | /** | 85 | /** |
76 | * @var Alias $alias | 86 | * @var Alias $alias |
77 | */ | 87 | */ |
@@ -130,7 +140,7 @@ | @@ -130,7 +140,7 @@ | ||
130 | return $prefix . '/' . $params[ 'alias' ][ 'value' ]; | 140 | return $prefix . '/' . $params[ 'alias' ][ 'value' ]; |
131 | } | 141 | } |
132 | } | 142 | } |
133 | - | 143 | + |
134 | return $prefix . parent::createUrl($params); | 144 | return $prefix . parent::createUrl($params); |
135 | } | 145 | } |
136 | 146 | ||
@@ -170,7 +180,7 @@ | @@ -170,7 +180,7 @@ | ||
170 | \Yii::$app->end(); | 180 | \Yii::$app->end(); |
171 | } | 181 | } |
172 | } | 182 | } |
173 | - | 183 | + |
174 | return $request; | 184 | return $request; |
175 | } | 185 | } |
176 | 186 |
frontend/config/main.php
@@ -310,6 +310,7 @@ | @@ -310,6 +310,7 @@ | ||
310 | 'class' => UrlManager::className(), | 310 | 'class' => UrlManager::className(), |
311 | 'baseUrl' => '/', | 311 | 'baseUrl' => '/', |
312 | 'enablePrettyUrl' => true, | 312 | 'enablePrettyUrl' => true, |
313 | + | ||
313 | 'showScriptName' => false, | 314 | 'showScriptName' => false, |
314 | 'rules' => [], | 315 | 'rules' => [], |
315 | 'hideDefaultLanguagePrefix' => true, | 316 | 'hideDefaultLanguagePrefix' => true, |