Magento 2 remove the store code in the store from the URL. The module is in effect only when web/url/use_store
is enabled and is meant to be used for multistore setups, where the main store shop should not contain any store code, whereas all other stores should.
composer require mageprashant/magento2-remove-store-code-from-url
bin/magento module:enable MagePrashant_RemoveStoreCode
bin/magento setup:upgrade
bin/magento cache:flush
bin/magento setup:di:compile
Enabled
- Stores > Settings > Configuration > MagePrashant Extensions > Remove store code from URL > General > Enabled: Yes
Remove store code from URL
When the store codes in the url are disabled, the URL of the stores looks like this: https://magento.com/
.
When the store codes in the url are enabled, the URL of the stores looks like this: https://magento.com/store_code/
.
When this extension is installed and enabled the module, and the store codes are enabled to be shown in the url under Store > Configuration > General > Web > Add Store Code, the module will not show the store code for the store for which you select the setting on stores but will show it for any other store.
So, for the default store the url will be https://magento.com/
while for all other store, the URL will be : https://magento.com/store_code
Want to contribute to this extension? The quickest way is to open a pull request on GitHub.
If you encounter any problems or bugs, please open an issue on GitHub.