I configured Magento 2 with two Store Views in order to have two front-end languages (English and Italian) and I would like to have the following behaviour:
http://example.com/ --> Store View "English" (code = "en") - Default
http://example.com/it/ --> Store View "Italian" (code = "it")
That is, the English Store View should be available on standard urls and the Italian Store View should be available within the "it" subfolder in the url. Nothing strange, a common configuration for multilanguage websites.
I found here a quite similar question regarding Magento 1.x: Different storeviews or websites in subfolders. But since the accepted answer is not trivial (it involves rewrites in the .htaccess
and modifications in the index.php
), I would like to ask if with Magento 2 there is a simpler way to get this done?
UPDATE
Premise: I don't mind about having multiple websites so I don't have the problem to having several websites with the same languages (that would be a problem for the below solution).
So I enabled the Add Store Code to Urls
option, from Configuration > Web > Url > Add Store Code to Urls, and it's working good. But now I have duplicated urls for the default language (English):
http://example.com/ --> Store View "English" (code = "en")
http://example.com/en/ --> Store View "English" (code = "en")
http://example.com/it/ --> Store View "Italian" (code = "it")
Is there a way to avoid this, i.e. avoid the subfolder in the url for the default language?