#1006 - Удаление дублей типа task-on.com task-on.com/ru

parent fc166b09
...@@ -3,12 +3,27 @@ namespace common\components; ...@@ -3,12 +3,27 @@ namespace common\components;
use Yii; use Yii;
use yii\web\Request; use yii\web\Request;
// use yii\helpers\Url;
use common\modules\languages\models\Languages; use common\modules\languages\models\Languages;
class LangRequest extends Request class LangRequest extends Request
{ {
private $_lang_url; private $_lang_url;
public function init()
{
$url = explode('/', $this->getUrl());
$url = $url[1];
$lang = Languages::getLangByUrl($url);
if($lang !== null && $lang->default)
{
header('Location: ' . $this->getLangUrl()); die();
}
parent::init();
}
public function getLangUrl() public function getLangUrl()
{ {
if ($this->_lang_url === null) if ($this->_lang_url === null)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment