0

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
3
  • 1
    Did you tried the built in Magento tool for this? It is under Catalog - Url rewrite
    – mbalparda
    Dec 22, 2014 at 21:14
  • Right suggestion. I thought there was already a url rewrite for that address. Thank you.
    – KaMZaTa
    Dec 22, 2014 at 22:19
  • I added this as an answer. Please mark it as accepted if this issue is solved.
    – mbalparda
    Dec 22, 2014 at 22:20

1 Answer 1

1

You should use the URL rewrite feature under Catalog - RL rewrite to solve this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.