Magento Multi-Website Setup

There are many ways to implement multiple websites with Magento. My favorite is using SetEnfIf (or SetEnv) (4 tweets) #tweetorial
Magento Multi-Website Setup: In the vhost declaration in the Apache configuration use ServerAlias for all additional domains
Magento Multi-Website Setup: Add mapping to the Mage website codes to the vhost: SetEnvIfNoCase Host ^www.example.com$ MAGE_RUN_CODE=[code]
Magento Multi-Website Setup: Add SetEnv MAGE_RUN_CODE=website to specify the type of RUN_CODE you are using to the vhost
Magento Multi-Website Setup: This works for stores as well. Be aware of a bug in the store cookie handling (core patch submitted): https://gist.github.com/1205913

And thanks to @Dan_The_Man regarding nginx:

@VinaiKopp map $http_host $magesite { example.com code; example.com code;} then down below fastcgi_param MAGE_RUN_CODE $magesite;

And, just out of curiosity, the nginx version: if ($host ~* ^(example.com|www.example.com)$ ) { env MAGE_RUN_CODE=[code]; }

  1. tweetorials posted this