Magento2: Remove Store Code URL only for default storeMagento : How to hide the default Store View code from the urlHow can I get the correct product url based on store view?How to Magento remove default store view code from url?Rewrite URL for multiples website/store viewsHow to Remove Url Parameters and make english store as defaultUsing URL subfolders for multi-language Store Views in Magento 2Remove multi-language storeview code from the url - Magento1.9Magento 2: Remove Store Code in URL only for default storeMagento 2 : How to remove the default Store langauge code from the URLLocalize contacts URL store wise

Invalid date error by date command

Is this toilet slogan correct usage of the English language?

Calculating total slots

What should you do when eye contact makes your subordinate uncomfortable?

Why is it that I can sometimes guess the next note?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?

On a tidally locked planet, would time be quantized?

Why Shazam when there is already Superman?

How to explain what's wrong with this application of the chain rule?

Can a stoichiometric mixture of oxygen and methane exist as a liquid at standard pressure and some (low) temperature?

What are the advantages of simplicial model categories over non-simplicial ones?

Pre-mixing cryogenic fuels and using only one fuel tank

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

How does a computer interpret real numbers?

Why is so much work done on numerical verification of the Riemann Hypothesis?

Open a doc from terminal, but not by its name

Is there a RAID 0 Equivalent for RAM?

Strong empirical falsification of quantum mechanics based on vacuum energy density

Can I say "fingers" when referring to toes?

What is Cash Advance APR?

Does IPv6 have similar concept of network mask?

Has any country ever had 2 former presidents in jail simultaneously?

What happens if you are holding an Iron Flask with a demon inside and walk into an Antimagic Field?



Magento2: Remove Store Code URL only for default store


Magento : How to hide the default Store View code from the urlHow can I get the correct product url based on store view?How to Magento remove default store view code from url?Rewrite URL for multiples website/store viewsHow to Remove Url Parameters and make english store as defaultUsing URL subfolders for multi-language Store Views in Magento 2Remove multi-language storeview code from the url - Magento1.9Magento 2: Remove Store Code in URL only for default storeMagento 2 : How to remove the default Store langauge code from the URLLocalize contacts URL store wise













7















I am developing a Magento 2 store with two store views, one for each language(English and Italian). I turned on the "Add Store Code to Urls" option from backend, so my URLs looks like:



http://mystore.com/en (English)
http://mystore.com/it (Italian)


What I would like to do now is to remove the store code from URL for the default store view, to obtain something like this:



http://mystore.com/ (English)
http://mystore.com/it (Italian)


In Magento 1.9 there a few extensions that do this. I need to find something (or develop) for Magento 2.



Anyone has some hints?



A good example of what I am searching for is this:
https://github.com/lalitmohann/magento-hide-default-store-code










share|improve this question














bumped to the homepage by Community 21 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















    7















    I am developing a Magento 2 store with two store views, one for each language(English and Italian). I turned on the "Add Store Code to Urls" option from backend, so my URLs looks like:



    http://mystore.com/en (English)
    http://mystore.com/it (Italian)


    What I would like to do now is to remove the store code from URL for the default store view, to obtain something like this:



    http://mystore.com/ (English)
    http://mystore.com/it (Italian)


    In Magento 1.9 there a few extensions that do this. I need to find something (or develop) for Magento 2.



    Anyone has some hints?



    A good example of what I am searching for is this:
    https://github.com/lalitmohann/magento-hide-default-store-code










    share|improve this question














    bumped to the homepage by Community 21 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      7












      7








      7


      1






      I am developing a Magento 2 store with two store views, one for each language(English and Italian). I turned on the "Add Store Code to Urls" option from backend, so my URLs looks like:



      http://mystore.com/en (English)
      http://mystore.com/it (Italian)


      What I would like to do now is to remove the store code from URL for the default store view, to obtain something like this:



      http://mystore.com/ (English)
      http://mystore.com/it (Italian)


      In Magento 1.9 there a few extensions that do this. I need to find something (or develop) for Magento 2.



      Anyone has some hints?



      A good example of what I am searching for is this:
      https://github.com/lalitmohann/magento-hide-default-store-code










      share|improve this question














      I am developing a Magento 2 store with two store views, one for each language(English and Italian). I turned on the "Add Store Code to Urls" option from backend, so my URLs looks like:



      http://mystore.com/en (English)
      http://mystore.com/it (Italian)


      What I would like to do now is to remove the store code from URL for the default store view, to obtain something like this:



      http://mystore.com/ (English)
      http://mystore.com/it (Italian)


      In Magento 1.9 there a few extensions that do this. I need to find something (or develop) for Magento 2.



      Anyone has some hints?



      A good example of what I am searching for is this:
      https://github.com/lalitmohann/magento-hide-default-store-code







      magento2 url url-rewrite store-view






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '16 at 11:58









      gianis6gianis6

      7301433




      7301433





      bumped to the homepage by Community 21 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 21 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          2 Answers
          2






          active

          oldest

          votes


















          0














          I had the same requirement and was able to solve it easily with just one plugin for MagentoStoreModelStore::isUseStoreInUrl method.



          public function afterIsUseStoreInUrl(MagentoStoreModelStore $subject, $resultIsUseInUrl)

          if ($subject->getCode() != $subject::ADMIN_CODE && $subject->isDefault())

          return $resultIsUseInUrl && $this->scopeConfig->getValue('web/url/use_store_in_default');

          else

          return $resultIsUseInUrl;




          I registered the plugin in global di.xml instead of frontend because the first time this method is called area has not yet been set so the plugin would not get executed.






          share|improve this answer






























            -1














            Changing Add Store Code to Urls to No fixes my same problem.



            Admin > Stores > Configuration > General > Web > URL options > Add Store Code to Urls > No





            share|improve this answer























            • This will turn it off for all stores. The question is about changing it only for the default store.

              – Domeglic
              Aug 7 '18 at 13:54










            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f145842%2fmagento2-remove-store-code-url-only-for-default-store%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I had the same requirement and was able to solve it easily with just one plugin for MagentoStoreModelStore::isUseStoreInUrl method.



            public function afterIsUseStoreInUrl(MagentoStoreModelStore $subject, $resultIsUseInUrl)

            if ($subject->getCode() != $subject::ADMIN_CODE && $subject->isDefault())

            return $resultIsUseInUrl && $this->scopeConfig->getValue('web/url/use_store_in_default');

            else

            return $resultIsUseInUrl;




            I registered the plugin in global di.xml instead of frontend because the first time this method is called area has not yet been set so the plugin would not get executed.






            share|improve this answer



























              0














              I had the same requirement and was able to solve it easily with just one plugin for MagentoStoreModelStore::isUseStoreInUrl method.



              public function afterIsUseStoreInUrl(MagentoStoreModelStore $subject, $resultIsUseInUrl)

              if ($subject->getCode() != $subject::ADMIN_CODE && $subject->isDefault())

              return $resultIsUseInUrl && $this->scopeConfig->getValue('web/url/use_store_in_default');

              else

              return $resultIsUseInUrl;




              I registered the plugin in global di.xml instead of frontend because the first time this method is called area has not yet been set so the plugin would not get executed.






              share|improve this answer

























                0












                0








                0







                I had the same requirement and was able to solve it easily with just one plugin for MagentoStoreModelStore::isUseStoreInUrl method.



                public function afterIsUseStoreInUrl(MagentoStoreModelStore $subject, $resultIsUseInUrl)

                if ($subject->getCode() != $subject::ADMIN_CODE && $subject->isDefault())

                return $resultIsUseInUrl && $this->scopeConfig->getValue('web/url/use_store_in_default');

                else

                return $resultIsUseInUrl;




                I registered the plugin in global di.xml instead of frontend because the first time this method is called area has not yet been set so the plugin would not get executed.






                share|improve this answer













                I had the same requirement and was able to solve it easily with just one plugin for MagentoStoreModelStore::isUseStoreInUrl method.



                public function afterIsUseStoreInUrl(MagentoStoreModelStore $subject, $resultIsUseInUrl)

                if ($subject->getCode() != $subject::ADMIN_CODE && $subject->isDefault())

                return $resultIsUseInUrl && $this->scopeConfig->getValue('web/url/use_store_in_default');

                else

                return $resultIsUseInUrl;




                I registered the plugin in global di.xml instead of frontend because the first time this method is called area has not yet been set so the plugin would not get executed.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 10 '18 at 7:03









                DomeglicDomeglic

                316319




                316319























                    -1














                    Changing Add Store Code to Urls to No fixes my same problem.



                    Admin > Stores > Configuration > General > Web > URL options > Add Store Code to Urls > No





                    share|improve this answer























                    • This will turn it off for all stores. The question is about changing it only for the default store.

                      – Domeglic
                      Aug 7 '18 at 13:54















                    -1














                    Changing Add Store Code to Urls to No fixes my same problem.



                    Admin > Stores > Configuration > General > Web > URL options > Add Store Code to Urls > No





                    share|improve this answer























                    • This will turn it off for all stores. The question is about changing it only for the default store.

                      – Domeglic
                      Aug 7 '18 at 13:54













                    -1












                    -1








                    -1







                    Changing Add Store Code to Urls to No fixes my same problem.



                    Admin > Stores > Configuration > General > Web > URL options > Add Store Code to Urls > No





                    share|improve this answer













                    Changing Add Store Code to Urls to No fixes my same problem.



                    Admin > Stores > Configuration > General > Web > URL options > Add Store Code to Urls > No






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 16 '18 at 12:29









                    RathnaRathna

                    408




                    408












                    • This will turn it off for all stores. The question is about changing it only for the default store.

                      – Domeglic
                      Aug 7 '18 at 13:54

















                    • This will turn it off for all stores. The question is about changing it only for the default store.

                      – Domeglic
                      Aug 7 '18 at 13:54
















                    This will turn it off for all stores. The question is about changing it only for the default store.

                    – Domeglic
                    Aug 7 '18 at 13:54





                    This will turn it off for all stores. The question is about changing it only for the default store.

                    – Domeglic
                    Aug 7 '18 at 13:54

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f145842%2fmagento2-remove-store-code-url-only-for-default-store%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Тонконіг бульбистий Зміст Опис | Поширення | Екологія | Господарське значення | Примітки | Див. також | Література | Джерела | Посилання | Навігаційне меню1114601320038-241116202404kew-435458Poa bulbosaЭлектронный каталог сосудистых растений Азиатской России [Електронний каталог судинних рослин Азіатської Росії]Малышев Л. Л. Дикие родичи культурных растений. Poa bulbosa L. - Мятлик луковичный. [Малишев Л. Л. Дикі родичи культурних рослин. Poa bulbosa L. - Тонконіг бульбистий.]Мятлик (POA) Сем. Злаки (Мятликовые) [Тонконіг (POA) Род. Злаки (Тонконогові)]Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Description from Flora of China) [Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Опис від Флора Китаю)]Poa bulbosa L. – lipnice cibulkatá / lipnica cibulkatáPoa bulbosa в базі даних Poa bulbosa на сайті Poa bulbosa в базі даних «Global Biodiversity Information Facility» (GBIF)Poa bulbosa в базі даних «Euro + Med PlantBase» — інформаційному ресурсі для Євро-середземноморського розмаїття рослинPoa bulbosa L. на сайті «Плантариум»

                    Лель (журнал) Зміст Історія | Редакція | Автори і рубрики | Інтерв'ю, статті, рецензії | Див. також | Посилання | Навігаційне менюперевірена1 змінаСергій Чирков: «Плейбой» і «Пентхауз» у кіосках з'явилися вже після того, як зник «Лель»«Лель», підшивка 10 номерів (1992, 1993)Ніч з «Другом Читача»: казки на ніч для дорослихІнформація про журнал на сервері журналістів у ВР УкраїниНаталія Патрікєєва. Лель. Перший український еротичний журналр

                    Best approach to update all entries in a list that is paginated?Best way to add items to a paginated listChoose Your Country: Best Usability approachUpdate list when a user is viewing the list without annoying themWhen would the best day to update your webpage be?What should happen when I add a Row to a paginated, sorted listShould I adopt infinite scrolling or classical pagination?How to show user that page objects automatically updateWhat is the best location to locate the comments section in a list pageBest way to combine filtering and selecting items in a listWhen one of two inputs must be updated to satisfy a consistency criteria, which should you update (if at all)?