瀏覽代碼

Merge branch 'dev'

prodstable
Guillaume Bourgeois 5 年之前
父節點
當前提交
b497eae64b
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. +7
    -5
      common/config/main.php

+ 7
- 5
common/config/main.php 查看文件

@@ -41,11 +41,13 @@ $serverName = $_SERVER['SERVER_NAME'] ;
return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'on beforeRequest' => function () {
$url = Yii::$app->request->getAbsoluteUrl();
if (!empty($url) && substr($url, -1) == '/') {
$url = substr($url, 0, strlen($url) - 1);
Yii::$app->getResponse()->redirect($url, 301);
Yii::$app->end();
if(method_exists(Yii::$app->request, 'getAbsoluteUrl')) {
$url = Yii::$app->request->getAbsoluteUrl();
if (!empty($url) && substr($url, -1) == '/') {
$url = substr($url, 0, strlen($url) - 1);
Yii::$app->getResponse()->redirect($url, 301);
Yii::$app->end();
}
}
},
'components' => [

Loading…
取消
儲存