Skip to content

Magento 2 – Redirect base url to base url with store code

In Magento 2 I have two stores with “add store code in url” option enable.

Store code 1 = “fr”

Store code 2 = “es”

I want to automatically add default store code in url:

Redirect http://mywebsite.com to http://mywebsite.com/fr/

Actually when I visit http://mywebsite.com I stay to this url and default store code is not added automatically.

Do you know how to change that ?
Is there a Magento 2 option for that ? Or should I write condition in .htaccess file ?