I created 2 blank page that have these address (Note that are different domains):
- www.mysite.com/cars.phtml (store_view_code = en)
- www.mysite.it/auto.phtml (store_view_code = it)
From cars.pthml page I would switching to auto.phtml page.
I tried to do this:
$params = array(
'_current' => TRUE,
'_use_rewrite' => TRUE,
'_store_to_url' => TRUE,
'_store' => it
);
$url = Mage::getUrl('', $params);
Mage::app()->getResponse()->setRedirect($url);
But redirection works partially because it redirect from 'www.mysite.com/cars.phtml' to 'www.mysite.it/cars.phtml' and generated obviously a 404 error.
To completeness this is how I set my .htaccess to handle store view redirection:
#######################################################
SetEnvIf Host www\.mysite\.com MAGE_RUN_CODE=en
SetEnvIf Host ^mysite\.com MAGE_RUN_CODE=en
SetEnvIf Host www\.mysite\.it MAGE_RUN_CODE=it
SetEnvIf Host ^mysite\.it MAGE_RUN_CODE=it