A
A
Alexander2016-04-22 11:54:22
PHP
Alexander, 2016-04-22 11:54:22

How to change the language on the site through a subdomain?

Hello!
The site uses 2 languages, Russian and English. Changing the language is done by adding ?lang={language} to the link.

<a href="?lang=russian">Русский язык</a>
<a href="?lang=english">Английский язык</a>

On each page of the site, in the links to change the language, ?lang=english is added :
for example: site.ru/videos?lang=english
And when you click on the link, the language changes.
Can you please tell me how to transfer the language selection to subdomains? Those. ru.site.ru and en.site.ru and so that when you click from any section, the link looks like en.site.ru/videos .
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ainur Shakirov, 2016-04-22
@Fqyeh29

Well, when you click on site.ru/videos?lang=english, write in cookies that the user has English.
And when accessing the site, read the cookies and redirect to en.site.ru/videos if the cookies contain English.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question