How to forward queries to?

Is bilingual site. Did you change the language via a redirect to pseudovector en/ . So everything works, but there is a possibility that somehow the user will turn the "wrong address", ie, enter the address while in the Russian session and Vice versa. To do a forced redirect via PHP. Ie
if ($_SESSION['lang'] == en AND !preg_match("!\/en\/!",$_SERVER['REQUEST_URI'])

Russian to English, this trick works, and from English into Russian it turns out the looping. A rule in htaccess to redirect this:
RewriteRule ^en/(.*)$ ./$1 [QSA,L]

Can't understand why fixate? What does he lack? Yes, Yeshe when you change the language always knocks on the front page, ie, either either Maybe something should be changed in htaccess, because the loop does not depend on PHP code.
June 3rd 19 at 19:14
1 answer
June 3rd 19 at 19:16
better to URL to keep the language code and for SEO well. If someone enters the search engine to the English version you they Russian? In the sessions it makes sense to keep when you go to any additional pages in the form LK or settings, and all that the public better with the prefixes of the language
Without sessions to do, the more that have divided the website into two. But not the fact that sullivane of sessions. Check - accomplish your goal. However, you need to decide how to give the website content without sessions, because it can be English speaking, but English-language writing from a computer, etc. - Haley_Haag93 commented on June 3rd 19 at 19:19

Find more questions by tags PHPhtaccess