diff --git a/common/models/DirectRedirect.php b/common/models/DirectRedirect.php new file mode 100644 index 0000000..0a131dd --- /dev/null +++ b/common/models/DirectRedirect.php @@ -0,0 +1,38 @@ + '/ru', + '/site/about' => '/ru/about', + '/site/contact' => '/ru/contact', + ); + if (isset($urlArray[$url])){ + $this->link = $urlArray[$url]; + return true; + } + + return false; + } + + public function getLink(): string + { + return trim($this->link, "/"); + } + } \ No newline at end of file diff --git a/frontend/config/main.php b/frontend/config/main.php index 4e456e5..c878bd7 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -46,6 +46,12 @@ return [ 'class' => SeoUrlManager::className(), 'enablePrettyUrl' => true, 'showScriptName' => false, + 'redirects' => [ + \common\models\DirectRedirect::className() + ], + 'processRoutes' => [ + 'page/view', + ], 'rules' => [ '\/robots.txt' => 'site/robots', '/' => 'site/index', diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index 1b36b91..2e42053 100755 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -31,7 +31,7 @@ _________________________________________________________ -->