Answer the question
In order to leave comments, you need to log in
How to organize multilingualism in Yii2 using subdomains?
Good day!
I came across an article with the implementation of multilingualism in Yii2 habrahabr.ru/post/226931 . I would like to know if it is possible to implement something similar, but with the use of subdomains (respectively, without actually creating them)? That is, the links should look like this: en.example.com/mypage.
Thanks in advance for your help!
Answer the question
In order to leave comments, you need to log in
In DNS, write a record like this:
@ A 123.123.123.123
Thus, the server will accept any subdomain
Then create the necessary WWW domains as aliases to this domain: en.domain.com, ua.domain.com, de.domain.com
So we say the server that when requesting subdomains en, ua, de, you need to show the main site.
Then, in Yii itself, catch the URL and parse it, assigning the current language.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question