|
|
|
|
|
|
|
|
'on beforeRequest' => function () { |
|
|
'on beforeRequest' => function () { |
|
|
if(method_exists(Yii::$app->request, 'getAbsoluteUrl')) { |
|
|
if(method_exists(Yii::$app->request, 'getAbsoluteUrl')) { |
|
|
$url = Yii::$app->request->getAbsoluteUrl(); |
|
|
$url = Yii::$app->request->getAbsoluteUrl(); |
|
|
if (!empty($url) && substr($url, -1) == '/') { |
|
|
|
|
|
|
|
|
if (!empty($url) && substr($url, -1) == '/' && substr($url, -5) != '.net/') { |
|
|
$url = substr($url, 0, strlen($url) - 1); |
|
|
$url = substr($url, 0, strlen($url) - 1); |
|
|
Yii::$app->getResponse()->redirect($url, 301); |
|
|
Yii::$app->getResponse()->redirect($url, 301); |
|
|
Yii::$app->end(); |
|
|
Yii::$app->end(); |