In order to get closer to users, large web stores usually support several store views based on specific language. By default, in Magento the same URL can display different locale interface which is, obviously, a bad thing for search engines and SEO. Using separate domain names for that matter does not always suite shop owners, and to say more, is not worth it.
Alternatively it is possible, and recommended, to use the Magento default setting "Add Store Code to Urls". However, there is a downside: it has Global Scope only. This means there’s no way to exclude default store code from URL as well as any other store view codes. As a result, the website gets duplicates, an unsightly URL for default store view.
Any means one can find on the internet to address the issue are complex to implement, not guaranteed to work properly, and involve interference in server’s regular workflow (workaround).
With the problem surfaced and having bumped into some serious bugs in Magento 2 itself, we've developed a solution easy to implement and properly working. The extension enables admin to set "Add Store Code to Urls" under specific Scope. No need to say more!
Successful installation of the extension automatically modifies the scope of setting below. Instead of Global, you should see Store View.
• Stores -> Configuration -> Web -> Url Options -> Add Store Code to Urls
We suggest you keep the setting unchanged under the Default Values Scope. Now switch to a particular Store View and enable the setting if needed.
All set? Time to check it out!
Extra functions of the extension:
• Fix for the annoying issue with default store switcher: whenever you switch the store with help of the built-in store switcher, the mod keeps the complete URL and doesn't redirect you to the home page;
• Fix for another issue with the store switcher when switching back to the default store view;
• Automatic redirects to proper URL: no worries about website's old links, ones like www.example.com/default/product.html, remaining in Google results or some other resources if you turned off the store code for the given store. The extension automatically manages 301 redirect so that the user gets to a proper URL without /default/ > www.example.com/product.html.
- Enables store code in URL only for selected store view
- Provides full and correct technical integration
- Doesn't require any special server tune-up
- Keeps the initial URL when switching stores via the store switcher, without redirecting to the home page
- Addresses the issue with the store switcher when switching back to default store view
- Automatically performs redirects if the URL entered contains the store code but the store code setting is off
CompatibilityMagento Open Source (CE) 2.1.x, 2.2.x
Magento Commerce (EE) 2.1.x, 2.2.x
We provide comprehensive product support for all the Magento extensions available on this site starting from the moment of your purchasing them. If you need help on the extensions installation or on any issues relating to our products, our dedicated team of proven technical experts is at your service, ready to assist you at any time.
Changelognew feature bugfix
- v.2.1.0 (Nov 20, 2017)
- Added compatibility with Magento 2.2.x.
- v.2.0.1 (Nov 16, 2017)
- Fixed an issue with infinite redirect on a default storeview's home page in Magento 2.1.10.
- v.2.0.0 (Apr 17, 2017)
- Initial release.