From 09140c4348a0f492932be430661465b33691e490 Mon Sep 17 00:00:00 2001 From: timur Date: Mon, 6 Nov 2017 18:06:07 +0200 Subject: [PATCH] direct redirects --- frontend/config/main.php | 4 ++++ frontend/models/DirectRedirects.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 0 deletions(-) create mode 100644 frontend/models/DirectRedirects.php diff --git a/frontend/config/main.php b/frontend/config/main.php index 46ed461..fdc357f 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -1,6 +1,7 @@ [ 'class' => SeoUrlManager::className(), 'enablePrettyUrl' => true, + 'redirects' => [ + DirectRedirects::className(), + ], 'showScriptName' => false, 'processRoutes' => [ 'page/view', diff --git a/frontend/models/DirectRedirects.php b/frontend/models/DirectRedirects.php new file mode 100644 index 0000000..38ee61b --- /dev/null +++ b/frontend/models/DirectRedirects.php @@ -0,0 +1,43 @@ + '/ru/o-klinike', + '/site/gallery' => '/ru/gallery', + '/blog/index' => '/ru/blog', + '/site/price' => '/ru/price', + '/site/contact' => '/ru/contacts', + '/persone/index' => '/ru/persons', + '/site/comments' => '/ru/comments', + ]; + + if (array_key_exists($url, $redirectArray)){ + $this->link = $redirectArray[$url]; + return true; + } + + return false; + } + + public function getLink(): string + { + return trim($this->link, "/"); + } + } \ No newline at end of file -- libgit2 0.21.4