In-Portal has a feature (disabled by default), which allows automatically change website language to one, that matches language from "Accept-Language" header, sent by user's browser on first visit.
This way, when user opens http://www.website.tld/ (website on primary language, since no language in url) he is automatically redirected to http://www.website.tld/user-language/index.html.
There is only one major problem: first visit detection. We presume, that first visit is when no page has been specified = home page.
Since home page url is / instead of /index.html user is redirected to http://www.website.tld/user-language/index.html each time he wants to change language back to primary website language while staying on Home Page.
Instead of redirect on empty url perform redirect only if referer isn't our website (using kHTTPQuery::refererIsOurSite method) in LanguagesItem::Load method (where redirect is made).