Apart from numerous ways to set up multiple Magento stores that all share the same codebase and backend, we are providing you with the simplest one. Else what method you use depends on your needs.
[This method may be similar to Parked Domain approach in C panel.]
For Apache:
<VirtualHost .. : ..> ... ServerName .... //add below entry in existing virtual host config ServerAlias new_store_domain-name ... </VirtualHost>
For Nginx:
server { ... //add new entry after existing server name on same line with space in between server_name ... new_store_domain.name ; ... }
Open up the index.php file for Magento and look for this line (it’s the last line of the file):
> Mage::run($mageRunCode, $mageRunType);
…and right before this, add the following code:
switch($_SERVER['HTTP_HOST']) { case '': $mageRunCode = '<store_code>'; $mageRunType = 'website'; break; }
If you have more than two storefronts, you will need to add additional cases to the above code block, e.g.:
switch($_SERVER['HTTP_HOST']) { case '': $mageRunCode = '<store_code1>'; $mageRunType = 'website'; break; case '': $mageRunCode = '<store_code2>'; $mageRunType = 'website'; break; }
e.g.- Suppose an existing Magento Server is Running over “www.test.com” and we are adding another new storefront named as “magento.test.com” then above entry is like
switch($_SERVER['HTTP_HOST']) { case 'magento.test.com': $mageRunCode = 'magento_code'; $mageRunType = 'website'; break; }
You have successfully set up a Magento store. Repeat the steps above for any additional stores you wish to create.
+1.714.2425683
+91.9852704704