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:
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.
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.