Maybe you can make it work, if you append the .htaccess file.
Add the following line above the existing part for friendly URLs
# The new line to convert languages in the path to a GET parameter
RewriteRule ^(en|fr|es)/(.*)$ $2?lang=$1 [QSA,DPI]
# The (already existing) Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
This line should convert a request that starts with en/
like https://mydomain.com/en/about
to the usual format https://mydomain.com/about?lang=en
.
Add all the languages you want to support to this list (en|fr|es)
in the pattern.
This alternative line should also work:
RewriteRule ^(en|fr|es)/(.*)$ index.php?q=$2&lang=$1 [L,QSA]
To generate the URLs in the new format you probably have to change this line in the snippet lingua.selector
$language['url'] = $pageURL . (!empty($hasQuery) ? '&' : '?') . $langKey . '=' . $language[$codeField];
where the language ($language[$codeField]
) is appended to the URL $pageURL
.
It seems that $pageURL
may or may not already contain the part for the language, so you probably have to use preg_match
and preg_replace
to either change the language part in $pageURL
or add it.