Poor mans multisite setup for Magento
In response to VinaIKopp and he’s informative mini-tutorials in twitter and current magento-multi-website-setup tweetorial. It’s a good idea for dedicated servers and not for all virtual-hosts.
Here is a description of my usual approach for setting up Magento multisite environment.
Here are few goals that I’d like to achieve: core code out of the way , clean public folders, packed for easier deployment and testing.
magento_base/
htdocs/
htdocs/website_01/
htdocs/website_01/index.php
htdocs/website_01/.htaccess <-- symlink
htdocs/website_01/js/ <--symlink
htdocs/website_01/skin/ <--symlink
htdocs/website_01/media/ <--symlink
htdocs/website_01/errors/ <--symlink
htdocs/website_01/downloader/ <--symlink
htdocs/website_02/
We setup magento isntallation to magento_base folder and right next to it (or any place you need or your virtual-host makes them) you’d make a folder for each of your subdomain, website (dependent of your multisite goals). Next we symlink public parts of magento to this folder and make a copy of index.php and change path for including Mage.php and set your website or store code at the end of it.
note that if you have few sites then you can make htdocs
inside magento_base for easier deployment and map your domains
inside that folder
Next step is to point your domain, subdomain and map it to right website folder and you are good to go:
- You get your codebase out of the public folder by pointing domains to public folder and symlinking Magento’s few public needs
- Upgrades won’t mess with your symlinked files and you don’t have to change server configuration files
- If you use git then you can have those symlinks pointed to stage, live branch checkouts and just push your changes to production or stage env’s
- You can test inside magento base folder on your test-server without conflicting your production settings and setup different sites (sites can be accessed by site or store code)
- client is pointed to public folder to upload his other stuff , campaigns, blogs whatever and that won’t be mixing with magento_base folder and you can make rules to include/exclude from your deployment procedure. No more crap inside.
Enjoy poor mans multisite setup without conflicting deployments and upgrades. Make it easier for clients and dev’s