Answer the question
In order to leave comments, you need to log in
How to forward requests correctly?
There is a bilingual site. I changed the language through a redirect to the en/ pseudodirectory. This is how everything works, but there is a possibility that somehow the user will turn to the "wrong address", i.e. will enter the site.ru/en address while in the Russian session and vice versa. To do this, I made a forced redirect through PHP. Those.
if ($_SESSION['lang'] == en AND !preg_match("!\/en\/!",$_SERVER['REQUEST_URI'])
redirect.
RewriteRule ^en/(.*)$ ./$1 [QSA,L]
Answer the question
In order to leave comments, you need to log in
it's better to keep the language code in the URL, and it's good for SEO. If someone switches from a search engine to the English version, will you give them Russian? It makes sense to store in sessions when you go to which additional pages in the form of personal accounts or settings, and everything that is publicly better with language prefixes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question