Blame view

frontend/config/main.php 1.02 KB
d1f8bd40   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  <?php
  
  use yii\helpers\ArrayHelper;
  
  /**
   * @author FilamentV <vortex.filament@gmail.com>
   * @copyright (c), Thread
   */
  return ArrayHelper::merge(ArrayHelper::merge(require(dirname(__DIR__, 2) . '/common/config/main.php'), [
      'id' => 'app-frontend',
      'basePath' => dirname(__DIR__),
      'sourceLanguage' => 'de-AT',
      'runtimePath' => '@runtime/frontend',
      'layoutPath' => '@app/layouts',
      'bootstrap' => require __DIR__ . '/bootstrap.php',
      'components' => require __DIR__ . '/components.php',
      'modules' => require(__DIR__ . '/modules.php'),
      'params' => require __DIR__ . '/params.php',
      // redirect to the page with the trailing slash
      'on beforeRequest' => function () {
          $app = Yii::$app;
          $pathInfo = $app->getRequest()->getPathInfo();
          if (!empty($pathInfo) && substr($pathInfo, -1) === '/') {
              header('Location: ' . $app->params['base']['baseUrl'] . '/' . rtrim($pathInfo, '/'), true, 301);
              exit();
          }
      },
  ]), require __DIR__ . '/main-local.php'
  );