The above solution works, but it takes some time. We just did the following to rewrite the language change URL when on the cms page go to the base URL:
Add the following code to app/design/frontend/default/template_name/template/page/switch/languages.html after the part where the variable $ url is filled (in ours it was like
$url = $_lang->getCurrentUrl();
so we added the following:
if(($this->getRequest()->getModuleName() == 'cms') && strpos($url,'.com/')){$url = strstr($url, '.com/', true) . '.com/';} elseif(($this->getRequest()->getModuleName() == 'cms') && strpos($url,'.de/')){$url = strstr($url, '.de/', true) . '.de/';} elseif(($this->getRequest()->getModuleName() == 'cms') && strpos($url,'.nl/')){$url = strstr($url, '.nl/', true) . '.nl/';}
What I did here is to check if the cms page is on and check if the URL contains .com / ;. de / or .nl and split the part and then add the domain extension back.
in our example: http://www.mega-watch.com/about-us?blabla will become http://www.mega-watch.com/
Hope this helps someone ...
source share