cancel
Showing results for 
Search instead for 
Did you mean: 

How to make to load languages like this /en /de /fr in the URL bar?

SOLVED

How to make to load languages like this /en /de /fr in the URL bar?

Dear, I am using Magento 2.2.x and need to make different languages to load like Folders - /en /de /fr

 

How can I achieve this, please help me?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to make to load languages like this /en /de /fr in the URL bar?

Hi @kostianev

 

Yes , you can easily do it with magento 2's native functionality.

 

Magento 2 have multi-store and multi-website functionality where we can create another store for another language.

 

lets take example - you need to create a new store in french language so create a new store from magento 2 backend from store->all stores menu. then give store code as fr.

 

Now go to the store->configuration->general->web-> Add Store Code to Urls as Yes !!

 

so on the frontend - when you see the language switcher and when click on French language store - in the URL it will shows yourdomain.com/fr

 

Below i am sharing reference links as well - how to create a store and make multi-language for the same.

 

https://www.mageworx.com/wiki/magento-2-multi-language/

 

http://inchoo.net/magento-2/magento-2-administration/create-multi-language-store-magento-2-part-2/

 

Hope it helps to you !!

 

 

if issue solved,Click Kudos & Accept as Solution

View solution in original post

8 REPLIES 8

Re: How to make to load languages like this /en /de /fr in the URL bar?

Hi @kostianev

 

Yes , you can easily do it with magento 2's native functionality.

 

Magento 2 have multi-store and multi-website functionality where we can create another store for another language.

 

lets take example - you need to create a new store in french language so create a new store from magento 2 backend from store->all stores menu. then give store code as fr.

 

Now go to the store->configuration->general->web-> Add Store Code to Urls as Yes !!

 

so on the frontend - when you see the language switcher and when click on French language store - in the URL it will shows yourdomain.com/fr

 

Below i am sharing reference links as well - how to create a store and make multi-language for the same.

 

https://www.mageworx.com/wiki/magento-2-multi-language/

 

http://inchoo.net/magento-2/magento-2-administration/create-multi-language-store-magento-2-part-2/

 

Hope it helps to you !!

 

 

if issue solved,Click Kudos & Accept as Solution

Re: How to make to load languages like this /en /de /fr in the URL bar?

@Manthan Dave Thank you, this is what I want. I have one additional question, can you tell me, if is it possible to make this:

 

For example I have 10 languages, but I want my default to be English. Now for every language I have /en /fr /de and etc. code, but is it possible to make for English version, which is my default store to be without code? So, English to use the default URL www.website.com and not /en in additional to the tail of the address?

Re: How to make to load languages like this /en /de /fr in the URL bar?

Hi @kostianev,

 

Using the "Add store code to URL" you can't.

That configuration is global.

 

Área de trabajo 1_001.png

 

 

That means you can't use different configuration values per website or store view level.

Re: How to make to load languages like this /en /de /fr in the URL bar?

Hi @kostianev

 

Glad to know that you have resolved your issue !!

 

@Damian Culotta - you are correct , its on global level - might be i missed out something !!

 

Using the "Add store code to URL" you can't.

 

if issue solved,Click Kudos & Accept as Solution

Re: How to make to load languages like this /en /de /fr in the URL bar?

Hi @Manthan Dave,

 

Can you share the configuration you've mentioned?

 

Re: How to make to load languages like this /en /de /fr in the URL bar?

Hi @Damian Culotta

 

rationalize - i think i missed out something or understand something else - you are correct !! i have updated my answer !!

if issue solved,Click Kudos & Accept as Solution

Re: How to make to load languages like this /en /de /fr in the URL bar?

Hi @kostianev,

 

There is a workaround using directories but you should need to set some directories/files and some configuration on your server.

I didn't tried this approach using M2 yet, and there isn't an official document to implement the approach but maybe you can explore this link: https://gist.github.com/thagxt/0f605f0a8a95c79302db0d2f04383788

That isn't a recomendation but a link to explore and learn how to get that kind of configuration.

Re: How to make to load languages like this /en /de /fr in the URL bar?

So, is it possible to remove /en from url in default language via .htaccess file with some code or something else? I just have about 10 languages and we want for default view English to have clear url, without /en in the url?