3

I need to redirect my magento to another domain after changing the language.

Example:

  • After select English - switch domain to mydomain.co.uk

  • After select Czech Republic - switch domain to mydomain.cz

Anyone know how to do ?

@Prince

Can you explain me more ? I have two languages set up and a working store switcher.

When I switch language then I get url:

From EN to CZ:

http://myweb.com/?___store=cz&___from_store=en

FROM CZ TO EN:

http://myweb.com/?___store=en&___from_store=cz

only now instead:

http://myweb.com/?___store=cz&___from_store=en

I want redirect:

http://myweb.cz/

EDIT2: I have created new website_Cz: enter image description here

and set language cz for new website

but now I cannot see this language on frontend switcher.

enter image description here

I know I'm still doing it wrong, I will be grateful if you can help me solve this problem.

2

According to your requirements, you have to create two websites with :

  • one language for each website
  • one domaine for each website

To switch between the two languages, you have to add some storeswitcher or a dropdown input.

EDIT:

You have this ?___store=... in your urls because you are using just one website with different storeview ! this is why i told you to use two websites and you create and set just one store and one view for each website, you set en language for the first website and cz for the the second.

nb: the languages you set them in the store view Stores -> All stores -> Storeview code and in Locale Stores -> Configuration -> General

More informations

EDIT 2: Please read my first reply :

"To switch between the two languages, you have to add some storeswitcher or a dropdown input."

The store switcher appear JUST when you have 2 store views under the current website that you are viewing.

Since you have only one store view for each website this doesn't appear.

You can Follow these tuto to set well your website config in admin and server part.

Create Multi Website/Stores in magento 2

http://www.dckap.com/blog/how-to-setup-multiple-stores-in-magento2/

| improve this answer | |
  • @Price, I have updated topic. Can you check? Thanks. – Sylvester Mar 8 '18 at 7:13
  • Ok I set domain on configuration --> WEB – Sylvester Mar 8 '18 at 7:32
  • I saw your update, you have this ?___store=... in your urls because you are using just one websitewith different storeview ! this is why i told you to use two websites with for each 1 store and one view. – PЯINCƏ Mar 8 '18 at 8:47
  • please look my edit 2 – PЯINCƏ Mar 8 '18 at 14:58
  • can you contact with me on my email: brandwrox1@gmail.com ? – Sylvester Mar 8 '18 at 16:26
2

Depending on what kind of server you're running you'll have to change your htaccess or your nginx settings.

First in the backend, specify your base urls at store > configuration > web

For the english storeview set http://domain.co.uk For the Czech storeview set http://domain.cz

For Apache: Then in your .htaccess set these lines:

SetEnv MAGE_RUN_TYPE store
SetEnvIf Host ^.*domain[-\.]co.uk MAGE_RUN_CODE=en
SetEnvIf Host ^.*domain[-\.]cz MAGE_RUN_CODE=cz

For Nginx

    map $host $storecode {
       hostnames;
       .domain.cz cz;
       .domain.co.uk en;
    }

    map $host $storetype {
       hostnames;
       default store;
    }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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