i am trying to set up 2 website (with 2 different domain names) to run on the same Magento 2 back end.
i created the 2 website,store,store view entries, than created two virtual hosts on the apache2 config file under sitesavailable. the problem i am having is setting up these two Magento environment variables:
Therefore, Apache would check what URL the visiting was trying to access (exampleone.com or exampletwo.com)⦠Then reroute the connection to the specific Web Site / Store View
I spotted a possible glitch in the examples above.
As per the Magento documentation you included, the MAGE_RUN_TYPE variable should be either website or store. In your example I think it should be website instead of english. Thatās how I am using it anyway.
If it might help someone ā¦
The way I am using this on Nexcess is by adding the second domain as a pointer and add this on top of my .htaccess file in my html root directory:
In my example, the Code for the Store View for both of the Websites are āenglishā. So, I did need to swap the variables around as you mentioned. But those variables relate to the screenshot example. If that makes sense? Although, I will admit that this is all worked out in my head until I actually test and document the real thing.
Quick heads up about the .htaccess file⦠Whenever you upgrade Magento, it replaces the .htaccess file with a default copy from the repository. When possible, save your edits in the Apache/NginX Config. Having said that, I did read somewhere once that you can configure Composer to never update the .htaccess file. But Iāve not looked into that yet. Currently, I still go in and put my amendments back after each upgrade - But that seems inefficient and easy to overlook.
I see what you mean. What Iām trying to say is that the MAGE_RUN_TYPE variable should have a value of either store or website (literally), since it denotes what entity type the MAGE_RUN_CODE is referring to. Now in your example it has the value exampleone or exampletwo (the ācodeā of a website).
As far as I can tell from the documentation, you also canāt use a store view code for MAGE_RUN_CODE. Only a website or store code (since these are the MAGE_RUN_TYPE options). I hope I am making some sense here
Thanks for the warning. I wasnāt aware of this. Might have to see whether I can access the NGINX settings on Nexcess, but I doubt it since I am using the shared SIP 100 package. Iāll try to keep it in mind though
Okay, I see what youāre saying. Iāll bookmark this topic and revisit after Iāve had a play around.
As for the .htaccess thing, having Composer skip the file might be a better fit. I think you have to edit the composer.json file in the Magento root directory, but honestly I canāt remember. If you find out, please let me know.